-
Notifications
You must be signed in to change notification settings - Fork 297
No longer use java.applet as it's scheduled for removal. #1029
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
modmuss50
wants to merge
6
commits into
FabricMC:master
Choose a base branch
from
modmuss50:stub-applet
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d3cb98b
No longer use java.applet as it's scheduled for removal.
modmuss50 ac3214a
Cleanup
modmuss50 3d1aa25
Fix issues on scaled displays
modmuss50 916db98
Merge branch 'master' into fork/modmuss50/stub-applet
modmuss50 6add1c7
Fix formatting
modmuss50 2be13b9
Transform all game classes to use the applet stub
modmuss50 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
101 changes: 101 additions & 0 deletions
101
minecraft/src/main/java/net/fabricmc/loader/impl/game/minecraft/applet/stub/Applet.java
This file contains hidden or 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,101 @@ | ||
/* | ||
* Copyright 2016 FabricMC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.fabricmc.loader.impl.game.minecraft.applet.stub; | ||
|
||
import java.awt.Dimension; | ||
import java.awt.Panel; | ||
import java.net.URL; | ||
import java.util.Locale; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
|
||
import net.fabricmc.loader.impl.game.minecraft.applet.AppletLauncher; | ||
|
||
/** | ||
* A minimal stub implementation of an Applet, just enough to make Minecraft happy. | ||
*/ | ||
public class Applet extends Panel { | ||
private @Nullable AppletLauncher appletLauncher; | ||
|
||
public final void setStub(AppletLauncher appletLauncher) { | ||
this.appletLauncher = appletLauncher; | ||
} | ||
|
||
public boolean isActive() { | ||
if (appletLauncher != null) { | ||
return appletLauncher.isActive(); | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
public URL getDocumentBase() { | ||
return appletLauncher.getDocumentBase(); | ||
} | ||
|
||
public URL getCodeBase() { | ||
return appletLauncher.getCodeBase(); | ||
} | ||
|
||
public String getParameter(String name) { | ||
return appletLauncher.getParameter(name); | ||
} | ||
|
||
@SuppressWarnings("deprecation") | ||
@Override | ||
public void resize(int width, int height) { | ||
Dimension d = size(); | ||
|
||
if ((d.width != width) || (d.height != height)) { | ||
super.resize(width, height); | ||
} | ||
} | ||
|
||
@SuppressWarnings("deprecation") | ||
@Override | ||
public void resize(Dimension d) { | ||
resize(d.width, d.height); | ||
} | ||
|
||
@Override | ||
public boolean isValidateRoot() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public Locale getLocale() { | ||
Locale locale = super.getLocale(); | ||
|
||
if (locale == null) { | ||
return Locale.getDefault(); | ||
} | ||
|
||
return locale; | ||
} | ||
|
||
public void init() { | ||
} | ||
|
||
public void start() { | ||
} | ||
|
||
public void stop() { | ||
} | ||
|
||
public void destroy() { | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
minecraft/src/main/java/net/fabricmc/loader/impl/game/minecraft/applet/stub/AppletStub.java
This file contains hidden or 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,20 @@ | ||
/* | ||
* Copyright 2016 FabricMC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.fabricmc.loader.impl.game.minecraft.applet.stub; | ||
|
||
public interface AppletStub { | ||
} |
This file contains hidden or 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 hidden or 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
46 changes: 46 additions & 0 deletions
46
src/main/java/net/fabricmc/loader/impl/transformer/MinecraftAppletTransformer.java
This file contains hidden or 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,46 @@ | ||
/* | ||
* Copyright 2016 FabricMC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.fabricmc.loader.impl.transformer; | ||
|
||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.objectweb.asm.ClassVisitor; | ||
import org.objectweb.asm.commons.ClassRemapper; | ||
import org.objectweb.asm.commons.Remapper; | ||
import org.objectweb.asm.commons.SimpleRemapper; | ||
|
||
import net.fabricmc.loader.impl.FabricLoaderImpl; | ||
|
||
public class MinecraftAppletTransformer extends ClassRemapper { | ||
private static final Remapper REMAPPER = new SimpleRemapper(getRenames()); | ||
|
||
private static Map<String, String> getRenames() { | ||
Map<String, String> renames = new HashMap<>(); | ||
|
||
// TODO move this transformer into the minecraft specific code. | ||
renames.put("java/applet/Applet", "net/fabricmc/loader/impl/game/minecraft/applet/stub/Applet"); | ||
renames.put("java/applet/AppletStub", "net/fabricmc/loader/impl/game/minecraft/applet/stub/AppletStub"); | ||
|
||
return Collections.unmodifiableMap(renames); | ||
} | ||
|
||
public MinecraftAppletTransformer(ClassVisitor classVisitor) { | ||
super(FabricLoaderImpl.ASM_VERSION, classVisitor, REMAPPER); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not sure keen on how this brings minecraft specific code over into the none minecraft part of loader, this will likely need to be solved by some future refactoring work.