-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from telvarost/mp-support-with-gcapi
Add multiplayer support with gcapi 2.0+
- Loading branch information
Showing
18 changed files
with
154 additions
and
131 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
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
70 changes: 47 additions & 23 deletions
70
src/main/java/com/github/telvarost/betatweaks/Config.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 |
---|---|---|
@@ -1,67 +1,91 @@ | ||
package com.github.telvarost.betatweaks; | ||
|
||
import blue.endless.jankson.Comment; | ||
import net.glasslauncher.mods.api.gcapi.api.ConfigName; | ||
import net.glasslauncher.mods.api.gcapi.api.GConfig; | ||
import net.glasslauncher.mods.api.gcapi.api.*; | ||
|
||
public class Config { | ||
|
||
@GConfig(value = "config", visibleName = "BetaTweaks Config") | ||
@GConfig(value = "config", visibleName = "BetaTweaks") | ||
public static ConfigFields config = new ConfigFields(); | ||
|
||
public static class ConfigFields { | ||
|
||
/** - These are a part of the InventoryTweaks mod. See: https://github.com/telvarost/InventoryTweaks-StationAPI */ | ||
// @ConfigName("Inventory Dragging Shortcuts") | ||
// public static Boolean inventoryDraggingShortcuts = true; | ||
// public Boolean inventoryDraggingShortcuts = true; | ||
|
||
/** - FOV added to the StationAPI version of FinalBeta instead */ | ||
// @ConfigName("FOV Slider") | ||
// public static Boolean fovSlider = true; | ||
// public Boolean fovSlider = true; | ||
|
||
/** - There are also title screen settings that are missing that the original BetaTweaks had */ | ||
// Dany added some of these to UniTweaks | ||
|
||
@ConfigName("Allow Gaps In Ladders") | ||
public static Boolean allowGapsInLadders = false; | ||
@MultiplayerSynced | ||
@ValueOnVanillaServer(booleanValue = TriBoolean.FALSE) | ||
public Boolean allowGapsInLadders = false; | ||
|
||
@ConfigName("Enter Fluids By South-East Corner") | ||
public static Boolean allowSouthEastRule = false; | ||
@MultiplayerSynced | ||
@ValueOnVanillaServer(booleanValue = TriBoolean.FALSE) | ||
public Boolean allowSouthEastRule = false; | ||
|
||
@ConfigName("Elevator Boats") | ||
public static Boolean elevatorBoats = false; | ||
@MultiplayerSynced | ||
@ValueOnVanillaServer(booleanValue = TriBoolean.FALSE) | ||
public Boolean elevatorBoats = false; | ||
|
||
@ConfigName("Hide Achievement Notifications") | ||
public static Boolean hideAchievementNotifications = false; | ||
public Boolean hideAchievementNotifications = false; | ||
|
||
@ConfigName("Hide Dead Shrubs") | ||
@Comment("Reload world for changes to take effect") | ||
public static Boolean hideDeadShrubs = false; | ||
@MultiplayerSynced | ||
@ValueOnVanillaServer(booleanValue = TriBoolean.FALSE) | ||
public Boolean hideDeadShrubs = false; | ||
|
||
@ConfigName("Hide Long Grass") | ||
@Comment("Reload world for changes to take effect") | ||
public static Boolean hideLongGrass = false; | ||
@MultiplayerSynced | ||
@ValueOnVanillaServer(booleanValue = TriBoolean.FALSE) | ||
public Boolean hideLongGrass = false; | ||
|
||
@ConfigName("Hoe Grass For Seeds") | ||
public static Boolean hoeGrassForSeeds = false; | ||
@MultiplayerSynced | ||
@ValueOnVanillaServer(booleanValue = TriBoolean.FALSE) | ||
public Boolean hoeGrassForSeeds = false; | ||
|
||
@ConfigName("Minecart Boosters") | ||
public static Boolean minecartBoosters = false; | ||
@MultiplayerSynced | ||
@ValueOnVanillaServer(booleanValue = TriBoolean.FALSE) | ||
public Boolean minecartBoosters = false; | ||
|
||
@ConfigName("Punch Sheep For Wool") | ||
public static Boolean punchSheepForWool = false; | ||
@MultiplayerSynced | ||
@ValueOnVanillaServer(booleanValue = TriBoolean.FALSE) | ||
public Boolean punchSheepForWool = false; | ||
|
||
@ConfigName("Punch TNT To Ignite") | ||
public static Boolean punchTntToIgnite = false; | ||
|
||
// @ConfigName("Spread Fire Infinitely") | ||
// public static Boolean infiniteFireSpread = false; | ||
// | ||
// /** - There is a bug that won't let the config go above 32, also Integer configs don't seem to save unless saved twice */ | ||
// @ConfigName("Spread Fire Tick Rate * 10 (Def: 4, Alpha: 1)") | ||
// public static Integer fireTickRate = 4; | ||
@MultiplayerSynced | ||
@ValueOnVanillaServer(booleanValue = TriBoolean.FALSE) | ||
public Boolean punchTntToIgnite = false; | ||
|
||
@ConfigName("Spread Fire Infinitely") | ||
@MultiplayerSynced | ||
@ValueOnVanillaServer(booleanValue = TriBoolean.FALSE) | ||
public Boolean infiniteFireSpread = false; | ||
|
||
@ConfigName("Spread Fire Tick Rate") | ||
@Comment("Default: 40, Alpha: 10") | ||
@MaxLength(36863) | ||
@MultiplayerSynced | ||
@ValueOnVanillaServer(booleanValue = TriBoolean.FALSE) | ||
public Integer fireSpreadTickRate = 40; | ||
|
||
@ConfigName("Use Player 2x2 Crafting Grid As Inventory") | ||
public static Boolean allowCraftingInventorySlots = false; | ||
@MultiplayerSynced | ||
@ValueOnVanillaServer(booleanValue = TriBoolean.FALSE) | ||
public Boolean allowCraftingInventorySlots = false; | ||
} | ||
} |
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
104 changes: 52 additions & 52 deletions
104
src/main/java/com/github/telvarost/betatweaks/mixin/FireMixin.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 |
---|---|---|
@@ -1,58 +1,58 @@ | ||
//package com.github.telvarost.betatweaks.mixin; | ||
// | ||
//import com.github.telvarost.betatweaks.Config; | ||
//import net.minecraft.block.BlockBase; | ||
//import net.minecraft.block.Fire; | ||
//import net.minecraft.block.material.Material; | ||
//import net.minecraft.level.Level; | ||
//import org.jetbrains.annotations.NotNull; | ||
//import org.spongepowered.asm.mixin.Mixin; | ||
//import org.spongepowered.asm.mixin.injection.*; | ||
// | ||
// | ||
///* | ||
// * Thanks to Amb0s for the original solution: https://github.com/Amb0s | ||
// */ | ||
//@Mixin(Fire.class) | ||
//public class FireMixin extends BlockBase | ||
//{ | ||
// public FireMixin(int i, int j) { | ||
// super(i, j, Material.FIRE); | ||
// this.setTicksRandomly(true); | ||
// } | ||
// | ||
// @ModifyConstant(method = "getTickrate", constant = @Constant(intValue = 40)) | ||
// private int betaTweaks_getTickrate(int a) | ||
// { | ||
// // It is 10 in beta before 1.6: | ||
// return (Config.ConfigFields.fireTickRate * 10); | ||
// } | ||
// | ||
// | ||
package com.github.telvarost.betatweaks.mixin; | ||
|
||
import com.github.telvarost.betatweaks.Config; | ||
import net.minecraft.block.BlockBase; | ||
import net.minecraft.block.Fire; | ||
import net.minecraft.block.material.Material; | ||
import net.minecraft.level.Level; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.*; | ||
|
||
|
||
/* | ||
* Thanks to Amb0s for the original solution: https://github.com/Amb0s | ||
*/ | ||
@Mixin(Fire.class) | ||
public class FireMixin extends BlockBase | ||
{ | ||
public FireMixin(int i, int j) { | ||
super(i, j, Material.FIRE); | ||
this.setTicksRandomly(true); | ||
} | ||
|
||
@ModifyConstant(method = "getTickrate", constant = @Constant(intValue = 40)) | ||
private int betaTweaks_getTickrate(int a) | ||
{ | ||
/** - Tick rate is 10 before beta 1.6 */ | ||
return (Config.config.fireSpreadTickRate); | ||
} | ||
|
||
|
||
@Redirect( | ||
method = "fireTick", | ||
at = @At(value = "INVOKE", | ||
target = "Lnet/minecraft/level/Level;placeBlockWithMetaData(IIIII)Z") | ||
) | ||
private boolean betaTweaks_fireTick(@NotNull Level level, int x, int y, int z, int id, int meta) | ||
{ | ||
// Make new fire blocks spawn with zero old: | ||
if (Config.config.infiniteFireSpread) | ||
{ | ||
level.placeBlockWithMetaData(x, y, z, BlockBase.FIRE.id, 0); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
/** - I couldn't figure out what this was supposed to be targeting */ | ||
// @Redirect( | ||
// method = "fireTick", | ||
// at = @At(value = "INVOKE", | ||
// target = "Lnet/minecraft/level/Level;placeBlockWithMetaData(IIIII)Z") | ||
// target = "Lnet/minecraft/src/BlockFire;setBurnResult(Lnet/minecraft/src/World;III)V") | ||
// ) | ||
// private boolean betaTweaks_fireTick(@NotNull Level level, int x, int y, int z, int id, int meta) | ||
// private void cancelSetBurnResult(BlockFire instance, World world, int x, int y, int z) | ||
// { | ||
// // Make new fire blocks spawn with zero old: | ||
// if (Config.ConfigFields.infiniteFireSpread) | ||
// { | ||
// level.placeBlockWithMetaData(x, y, z, BlockBase.FIRE.id, 0); | ||
// } | ||
// | ||
// return false; | ||
// // Remove a chance to burn a block before the fire block old will reach 15. | ||
// } | ||
// | ||
// /** - I couldn't figure out what this was supposed to be targeting */ | ||
//// @Redirect( | ||
//// method = "fireTick", | ||
//// at = @At(value = "INVOKE", | ||
//// target = "Lnet/minecraft/src/BlockFire;setBurnResult(Lnet/minecraft/src/World;III)V") | ||
//// ) | ||
//// private void cancelSetBurnResult(BlockFire instance, World world, int x, int y, int z) | ||
//// { | ||
//// // Remove a chance to burn a block before the fire block old will reach 15. | ||
//// } | ||
//} | ||
} |
Oops, something went wrong.