-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated to 1.20.2 and added boolean values
- also added IF_TRUE, INVERT, AND, OR, XOR - added Repeat While and Set to Condition
- Loading branch information
Showing
83 changed files
with
1,170 additions
and
270 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
2 changes: 1 addition & 1 deletion
2
src/main/java/io/github/techstreet/dfscript/event/ServerLeaveEvent.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
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
29 changes: 29 additions & 0 deletions
29
src/main/java/io/github/techstreet/dfscript/mixin/game/MClientCommonNetworkHandler.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,29 @@ | ||
package io.github.techstreet.dfscript.mixin.game; | ||
|
||
import com.mojang.blaze3d.systems.RenderSystem; | ||
import io.github.techstreet.dfscript.DFScript; | ||
import io.github.techstreet.dfscript.event.*; | ||
import io.github.techstreet.dfscript.event.system.EventManager; | ||
import io.github.techstreet.dfscript.util.hypercube.HypercubeRank; | ||
import io.github.techstreet.dfscript.util.hypercube.HypercubeUtil; | ||
import net.minecraft.client.network.ClientCommonNetworkHandler; | ||
import net.minecraft.client.network.ClientPlayNetworkHandler; | ||
import net.minecraft.network.ClientConnection; | ||
import net.minecraft.network.listener.ClientCommonPacketListener; | ||
import net.minecraft.network.packet.s2c.common.DisconnectS2CPacket; | ||
import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket; | ||
import net.minecraft.network.packet.s2c.play.GameMessageS2CPacket; | ||
import net.minecraft.network.packet.s2c.play.TeamS2CPacket; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(ClientCommonNetworkHandler.class) | ||
public class MClientCommonNetworkHandler { | ||
@Inject(method = "onDisconnect", at = @At("RETURN"), cancellable = true) | ||
private void onDisconnect(DisconnectS2CPacket packet, CallbackInfo ci) { | ||
ServerLeaveEvent event = new ServerLeaveEvent(packet); | ||
EventManager.getInstance().dispatch(event); | ||
} | ||
} |
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
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
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
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
61 changes: 61 additions & 0 deletions
61
src/main/java/io/github/techstreet/dfscript/screen/script/ScriptConditionCategoryScreen.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,61 @@ | ||
package io.github.techstreet.dfscript.screen.script; | ||
|
||
import io.github.techstreet.dfscript.DFScript; | ||
import io.github.techstreet.dfscript.screen.CScreen; | ||
import io.github.techstreet.dfscript.screen.widget.CItem; | ||
import io.github.techstreet.dfscript.script.Script; | ||
import io.github.techstreet.dfscript.script.ScriptPart; | ||
import io.github.techstreet.dfscript.script.ScriptSnippet; | ||
import io.github.techstreet.dfscript.script.action.ScriptActionCategory; | ||
import io.github.techstreet.dfscript.script.conditions.ScriptBuiltinCondition; | ||
import io.github.techstreet.dfscript.script.conditions.ScriptCondition; | ||
import io.github.techstreet.dfscript.script.conditions.ScriptConditionType; | ||
|
||
import java.util.function.Consumer; | ||
import java.util.function.Function; | ||
|
||
public class ScriptConditionCategoryScreen extends CScreen { | ||
|
||
private static final int size; | ||
|
||
static { | ||
size = (int) (Math.ceil(Math.sqrt(ScriptActionCategory.values().length)) * 10)+4; | ||
} | ||
|
||
private final Script script; | ||
|
||
private final ScriptSnippet snippet; | ||
|
||
private final int insertIndex; | ||
|
||
private final Function<ScriptCondition, ScriptPart> partCreator; | ||
|
||
public ScriptConditionCategoryScreen(Script script, ScriptSnippet snippet, int insertIndex, Function<ScriptCondition, ScriptPart> partCreator) { | ||
super(size, size); | ||
this.script = script; | ||
this.snippet = snippet; | ||
this.insertIndex = insertIndex; | ||
this.partCreator = partCreator; | ||
|
||
int x = 3; | ||
int y = 3; | ||
|
||
for (ScriptActionCategory category : ScriptActionCategory.values()) { | ||
CItem actionItem = new CItem(x, y, category.getIcon()); | ||
widgets.add(actionItem); | ||
|
||
actionItem.setClickListener(btn -> DFScript.MC.setScreen(new ScriptConditionSelectScreen(script, snippet, insertIndex, partCreator, category))); | ||
|
||
x += 10; | ||
if (x >= size - 10) { | ||
x = 3; | ||
y += 10; | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void close() { | ||
DFScript.MC.setScreen(new ScriptAddPartScreen(script, snippet, insertIndex, ScriptActionCategory.CONDITIONS)); | ||
} | ||
} |
Oops, something went wrong.