Skip to content

Commit

Permalink
Updates for 1.0.3
Browse files Browse the repository at this point in the history
* Add drop all items when killing the player
* Disable send player to spawn point when riding
* Change spaws to #3
* Add following spawn mobs:
	*	Sheep
	*	Villager
	*	Fish (Tropical Fish)
	*	Wither
	*	Slime
	*	Silver Fish
	*	Ravager
	*	Phantom
	*	Vex
* And following Items:
	*	Wood
	*	Crafiting Table
* Add change difficult effect for #1
* Bump Version to 1.0.3
  • Loading branch information
racerxdl committed Mar 1, 2020
1 parent 4601794 commit b725a75
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 15 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = '1.0.2'
version = '1.0.3'
group = 'com.racerxdl.minecrowdcontrol' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'minecrowdcontrol'

Expand Down Expand Up @@ -146,4 +146,4 @@ publishing {
url "file:///${project.projectDir}/mcmodsrepo"
}
}
}
}
11 changes: 6 additions & 5 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
#Sat Feb 29 20:51:16 BRT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
2 changes: 1 addition & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set JAVA_HOME="C:\Users\Lucas Teske\.IntelliJIdea2019.3\config\jdks\jbsdk8u112b287.2_windows_x64\jre"
set JAVA_HOME="C:\Users\Lucas Teske\.IntelliJIdea2019.3\config\jdks\jbsdk8u202b1491_windows_x64\jre"


@rem Find java.exe
Expand Down
15 changes: 14 additions & 1 deletion minecrowdcontrol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,15 @@ public Minecraft(IPlayer player, Func<CrowdControlBlock, bool> responseHandler,
new Effect("Spawn Zombie", "spawn_zombie"),
new Effect("Spawn Cow", "spawn_cow"),
new Effect("Spawn Chicken", "spawn_chicken"),
new Effect("Spawn Pig", "spawn_pig"),
new Effect("Spawn Sheep", "spawn_sheep"),
new Effect("Spawn Villager", "spawn_villager"),
new Effect("Spawn Wither", "spawn_wither"),
new Effect("Spawn Slime", "spawn_slime"),
new Effect("Spawn Silver Fish", "spawn_silverfish"),
new Effect("Spawn Ravager", "spawn_ravager"),
new Effect("Spawn Phantom", "spawn_phantom"),
new Effect("Spawn Vex", "spawn_vex"),
new Effect("Spawn Fish", "spawn_tropicalfish"),

new Effect("Create Leather", "create_leather"),
new Effect("Create Stone", "create_stone"),
Expand All @@ -71,5 +79,10 @@ public Minecraft(IPlayer player, Func<CrowdControlBlock, bool> responseHandler,
new Effect("Create Diamon Horse Armor", "create_diamondhorsearmor"),
new Effect("Create Diamon Shovel", "create_diamondshovel"),
new Effect("Create Ender Pearl", "create_enderpearl"),

new Effect("Set Difficult to Peaceful", "set_difficult_peaceful"),
new Effect("Set Difficult to Easy", "set_difficult_easy"),
new Effect("Set Difficult to Normal", "set_difficult_normal"),
new Effect("Set Difficult to Hard", "set_difficult_hard"),
};
}
57 changes: 55 additions & 2 deletions src/main/java/com/racerxdl/minecrowdcontrol/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.Difficulty;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
Expand Down Expand Up @@ -72,16 +73,28 @@ public class Commands {
EntityType.ZOMBIE,
EntityType.COW,
EntityType.CHICKEN,
EntityType.PIG
EntityType.PIG,
EntityType.SHEEP,
EntityType.VILLAGER,
EntityType.WITHER,
EntityType.SLIME,
EntityType.SILVERFISH,
EntityType.RAVAGER,
EntityType.PHANTOM,
EntityType.VEX,
EntityType.TROPICAL_FISH
));

private static final List<Item> spawnItems = new ArrayList<>(Arrays.asList(
Items.LEATHER,
Items.STONE,
Items.OAK_WOOD,
Items.IRON_INGOT,
Items.GOLD_INGOT,
Items.DIAMOND,

Items.CRAFTING_TABLE,

Items.STONE_PICKAXE,
Items.STONE_SWORD,
Items.STONE_AXE,
Expand All @@ -96,6 +109,13 @@ public class Commands {
Items.DIAMOND_SHOVEL
));

private static final List<Difficulty> difficults = new ArrayList<>(Arrays.asList(
Difficulty.PEACEFUL,
Difficulty.EASY,
Difficulty.NORMAL,
Difficulty.HARD
));

static {
spawnEntities.forEach((et) -> {
String entityName = et.getName().getString().toUpperCase().replace(" ", "");
Expand All @@ -108,6 +128,12 @@ public class Commands {
Log.info("Adding command CREATE_{}", itemName);
CommandList.put("CREATE_" + itemName, (states, player, u1, server, viewer, type) -> SpawnItem(states, player, server, viewer, type, item));
});

difficults.forEach((diff) -> {
String diffName = diff.getDisplayName().getUnformattedComponentText().toUpperCase().replace(" ", "");
Log.info("Adding command SET_DIFFICULT_{}", diffName);
CommandList.put("SET_DIFFICULT_" + diffName, (states, player, u1, server, viewer, type) -> SetDifficult(states, player, server, viewer, type, diff));
});
}

public static void SetEnablePlayerMessages(boolean status) {
Expand Down Expand Up @@ -141,6 +167,28 @@ public static void SendSystemMessage(MinecraftServer server, String msg, Object.
});
}

public static CommandResult SetDifficult(PlayerStates states, PlayerEntity player, MinecraftServer server, String viewer, RequestType type, Difficulty diff) {
CommandResult res = new CommandResult(states);
if (type == RequestType.Test) {
return res.SetEffectResult(EffectResult.Success);
}

if (type == RequestType.Stop || player.getEntityWorld().getWorldInfo().getDifficulty() == diff) {
return res.SetEffectResult(EffectResult.Unavailable);
}

player.getEntityWorld().getWorldInfo().setDifficultyLocked(false);
player.getEntityWorld().getWorldInfo().setDifficulty(diff);
player.getEntityWorld().getWorldInfo().setDifficultyLocked(true);


Log.info(Messages.ServerSetDifficult, viewer, diff.getDisplayName().getUnformattedComponentText());
SendPlayerMessage(player, Messages.ClientSetDifficult, viewer, diff.getDisplayName().getUnformattedComponentText());

return res.SetEffectResult(EffectResult.Success);
}


public static CommandResult SpawnItem(PlayerStates states, PlayerEntity p, MinecraftServer server, String viewer, RequestType type, Item item) {
CommandResult res = new CommandResult(states);

Expand Down Expand Up @@ -196,7 +244,6 @@ public static CommandResult ExplodePlayer(PlayerStates states, PlayerEntity p, M

if (result) {
client.player.playSound(SoundEvents.ENTITY_ENDERMAN_SCREAM, 6, 0.25f);
Log.debug("WOLOLO");
p.world.makeFireworks(p.getPosX(), p.getPosY(), p.getPosZ() + 20, 0, 0, 0, null);
p.setMotion(2, 2, 2);
}
Expand Down Expand Up @@ -498,6 +545,9 @@ public static CommandResult SendPlayerToSpawnPoint(PlayerStates states, PlayerEn
if (player.getHealth() == 0) {
return false;
}
if (player.isPassenger()) {
return false;
}
BlockPos spawnPoint = player.getEntityWorld().getSpawnPoint();

player.setPositionAndUpdate(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ());
Expand Down Expand Up @@ -815,6 +865,9 @@ public static CommandResult KillPlayers(PlayerStates states, PlayerEntity unused
float health = player.getHealth();
if (health != 0) {
Log.info(Messages.ServerKill, viewer, player.getName().getString());
player.inventory.mainInventory.forEach(is -> player.dropItem(is, false));
player.inventory.offHandInventory.forEach(is -> player.dropItem(is, false));
player.inventory.armorInventory.forEach(is -> player.dropItem(is, false));
SendPlayerMessage(player, Messages.ClientKill, viewer);
player.setHealth(0);
return true;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/racerxdl/minecrowdcontrol/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class Messages {
public static final String ServerDropItem = "Viewer {} just dropped {} {}";
public static final String ServerRepairItem = "Viewer {} just repaired {} {}";
public static final String ServerCreateItem = "Viewer {} just gave {} a {}";
public static final String ServerSetDifficult = "Viewer {} just set game difficult to {}";
// endregion

// region Client Messages
Expand Down Expand Up @@ -66,5 +67,6 @@ public class Messages {
public static final String ClientDropItem = TextFormatting.RED + "Viewer {0} just dropped your {1}";
public static final String ClientRepairItem = TextFormatting.RED + "Viewer {0} just repaired your {1}";
public static final String ClientCreateItem = TextFormatting.GREEN + "Viewer {0} just gave you a {1}";
public static final String ClientSetDifficult = TextFormatting.GOLD + "Viewer {0} just set game difficult to {1}";
// endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public MineCrowdControl() {
modconfig = new CrowdControlModConfig(modContainer);
modContainer.addConfig(modconfig);

Log.debug("Config file: " + modconfig.getFileName());

// Register the setup method for modloading
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
// Register the doClientStuff method for modloading
Expand Down
9 changes: 5 additions & 4 deletions update.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"1.15.2": {
"1.0.0": "First Release! CrowdControl working",
"1.0.1": "Add more spawn mobs and create items",
"1.0.2": "Fixed Int Enum types being serialized as string causing refunds for coins"
"1.0.2": "Fixed Int Enum types being serialized as string causing refunds for coins",
"1.0.3": "Add drop all items when killing the player\nDisable 'send player to spawn point' when riding\nChange spawns: \n\tAdd following spawn mobs: Sheep, Villager, Fish, Wither, Slime, Silver Fish, Ravager, Phantom, Vex\n\tAdd following spawn items: Wood, Crafiting Table\nAdd difficult change effects"
},
"promos": {
"1.15.2-latest": "1.0.2",
"1.15.2-recommended": "1.0.2"
"1.15.2-latest": "1.0.3",
"1.15.2-recommended": "1.0.3"
}
}
}

0 comments on commit b725a75

Please sign in to comment.