Skip to content

Commit

Permalink
Merge pull request #77 from Gilly7CE/mcversion-1.18.2
Browse files Browse the repository at this point in the history
Update minecraft version to 1.18.2
  • Loading branch information
Gilly7CE authored May 15, 2023
2 parents 44cddd0 + 124b8a2 commit f85e5a0
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 85 deletions.
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.19.3
yarn_mappings=1.19.3+build.5
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.4
loader_version=0.14.19
# Mod Properties
mod_version=1.0.0-beta.3
Expand All @@ -12,5 +12,5 @@ archives_base_name=gilly7ce-carpet-addons
# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
# fabric_version=0.25.1+build.416-1.16
carpet_core_version=1.4.96+v230201
carpet_minecraft_version=1.19.3
carpet_core_version=1.4.69+v220331
carpet_minecraft_version=1.18.2
4 changes: 2 additions & 2 deletions src/main/java/gillycarpetaddons/GillyCarpetAddonsServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import carpet.CarpetExtension;
import carpet.CarpetServer;
import carpet.api.settings.SettingsManager;
import carpet.settings.SettingsManager;
import carpet.utils.Translations;
import gillycarpetaddons.ruleobservers.movableSpawnerRuleObserver;
import net.fabricmc.api.ModInitializer;
Expand All @@ -17,7 +17,7 @@ public void onInitialize() {

@Override
public void onGameStarted() {
SettingsManager.registerGlobalRuleObserver(new movableSpawnerRuleObserver());
SettingsManager.addGlobalRuleObserver(new movableSpawnerRuleObserver());
CarpetServer.settingsManager.parseSettingsClass(GillyCarpetAddonsSettings.class);
}

Expand Down
60 changes: 41 additions & 19 deletions src/main/java/gillycarpetaddons/GillyCarpetAddonsSettings.java
Original file line number Diff line number Diff line change
@@ -1,61 +1,83 @@
package gillycarpetaddons;

import carpet.api.settings.Rule;
import carpet.settings.Rule;

import static carpet.api.settings.RuleCategory.*;
import static carpet.settings.RuleCategory.*;

public class GillyCarpetAddonsSettings {
private static final String GILLY = "gilly7ce-carpet-addons";

@Rule(categories = { FEATURE, CREATIVE, GILLY })
@Rule(desc = "Allows players in Creative mode to kill entities in one hit.", category = { FEATURE, CREATIVE, GILLY })
public static boolean creativePlayerOneHitKill = false;

@Rule(categories = { CREATIVE, FEATURE, GILLY })
@Rule(desc = "Phantoms will no longer spawn for creative players.", category = { CREATIVE, FEATURE, GILLY })
public static boolean disablePhantomSpawningForCreativePlayers = false;

@Rule(categories = { FEATURE, GILLY })
@Rule(desc = "Phantoms will no longer spawn in a mushroom fields biome.", category = { FEATURE, GILLY })
public static boolean disablePhantomSpawningInMushroomFields = false;

@Rule(categories = { FEATURE, DISPENSER, GILLY })
@Rule(desc = "Dispensers can place eyes of ender into end portal frames.", category = { FEATURE, DISPENSER, GILLY })
public static boolean dispensersPlaceEyesOfEnder = false;

@Rule(categories = { FEATURE, EXPERIMENTAL, DISPENSER, GILLY })
@Rule(desc = "Dispensers can remove eyes of ender from full end portal frames. Any connecting end portals will " +
"break.",
category = { FEATURE, EXPERIMENTAL, DISPENSER, GILLY })
public static boolean dispensersRemoveEyesOfEnder = false;

@Rule(categories = { FEATURE, EXPERIMENTAL, GILLY })
@Rule(desc = "A full end portal frame will drop an eye of ender when right clicked by a player, turning into an " +
"empty end portal frame in the process. Any connecting end portals will break.",
category = { FEATURE, EXPERIMENTAL, GILLY })
public static boolean dropEyesOfEnderFromEndPortalFrame = false;

@Rule(categories = { FEATURE, EXPERIMENTAL, GILLY })
@Rule(desc = "Allows empty end portal frames to be moved.\nThe `drop_as_items_on_explosion` option will allow end " +
"portal frames to drop as items when an explosion occurs whilst being pushed by a piston.",
category = { FEATURE, EXPERIMENTAL, GILLY })
public static MovableBlockOptions movableEmptyEndPortalFrames = MovableBlockOptions.FALSE;

@Rule(categories = { FEATURE, EXPERIMENTAL, GILLY })
@Rule(desc = "Allows spawners to be moved.\nThis requires the carpet movableBlockEntities rule to be enabled",
category = { FEATURE, EXPERIMENTAL, GILLY })
public static boolean movableSpawners = false;

@Rule(categories = { SURVIVAL, GILLY })
@Rule(desc = "A netherite axe with efficiency V combined with the haste II status effect will instant mine wood and" +
" nether wood type blocks.",
category = { SURVIVAL, GILLY })
public static boolean netheriteAxeInstantMineWood = false;

@Rule(categories = { SURVIVAL, GILLY })
@Rule(desc = "A netherite pickaxe with efficiency V combined with the haste II status effect will instant mine blue" +
" ice blocks.",
category = { SURVIVAL, GILLY })
public static boolean netheritePickaxeInstantMineBlueIce = false;

@Rule(categories = { SURVIVAL, GILLY })
@Rule(desc = "A netherite pickaxe with efficiency V combined with the haste II status effect will instant mine " +
"cobblestone type blocks.",
category = { SURVIVAL, GILLY })
public static boolean netheritePickaxeInstantMineCobblestone = false;

@Rule(categories = { SURVIVAL, GILLY })
@Rule(desc = "A netherite pickaxe with efficiency V combined with the haste II status effect will instant mine " +
"deepslate type blocks.",
category = { SURVIVAL, GILLY })
public static boolean netheritePickaxeInstantMineDeepslate = false;

@Rule(categories = { SURVIVAL, GILLY })
@Rule(desc = "A netherite pickaxe with efficiency V combined with the haste II status effect will instant mine end " +
"stone type blocks.",
category = { SURVIVAL, GILLY })
public static boolean netheritePickaxeInstantMineEndStone = false;

@Rule(categories = { SURVIVAL, GILLY })
@Rule(desc = "A netherite pickaxe with efficiency V combined with the haste II status effect will instant mine " +
"nether brick type blocks.",
category = { SURVIVAL, GILLY })
public static boolean netheritePickaxeInstantMineNetherBricks = false;

@Rule(categories = { FEATURE, GILLY })
@Rule(desc = "Phantoms will no longer spawn if the hostile mobcap is full. This is per player.",
category = { FEATURE, GILLY })
public static boolean phantomsObeyHostileMobCap = false;

@Rule(categories = { FEATURE, EXPERIMENTAL, GILLY })
@Rule(desc = "Spectator players can go through nether portals, end portals and end gateways.",
category = { FEATURE, EXPERIMENTAL, GILLY })
public static boolean spectatorPlayersUsePortals = false;

@Rule(categories = { FEATURE, GILLY })
@Rule(desc = "Bubble columns will push or pull XP orb entities like with other entities and items.",
category = { FEATURE, GILLY })
public static boolean xpBubbleColumnInteraction = false;

public enum MovableBlockOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private ItemStack addItemToStack(ItemStack itemStack, Item itemToAdd) {
}

private boolean addToFirstAvailableSlot(DispenserBlockEntity dispenserBlockEntity, Item itemToAdd) {
for (int slot = 0; slot < DispenserBlockEntity.INVENTORY_SIZE; slot++) {
for (int slot = 0; slot < dispenserBlockEntity.size(); slot++) {
ItemStack currentSlotStack = dispenserBlockEntity.getStack(slot);
ItemStack newStack = addItemToStack(currentSlotStack, itemToAdd);
if (newStack != null) {
Expand Down
11 changes: 1 addition & 10 deletions src/main/java/gillycarpetaddons/lists/BlockList.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public class BlockList {
Blocks.DARK_OAK_FENCE_GATE,
Blocks.CRIMSON_FENCE_GATE,
Blocks.WARPED_FENCE_GATE,
Blocks.MANGROVE_FENCE_GATE,
Blocks.OAK_FENCE,
Blocks.SPRUCE_FENCE,
Blocks.BIRCH_FENCE,
Expand All @@ -81,7 +80,6 @@ public class BlockList {
Blocks.DARK_OAK_FENCE,
Blocks.CRIMSON_FENCE,
Blocks.WARPED_FENCE,
Blocks.MANGROVE_FENCE,
Blocks.OAK_LOG,
Blocks.SPRUCE_LOG,
Blocks.BIRCH_LOG,
Expand All @@ -90,7 +88,6 @@ public class BlockList {
Blocks.DARK_OAK_LOG,
Blocks.CRIMSON_STEM,
Blocks.WARPED_STEM,
Blocks.MANGROVE_LOG,
Blocks.STRIPPED_OAK_LOG,
Blocks.STRIPPED_SPRUCE_LOG,
Blocks.STRIPPED_BIRCH_LOG,
Expand All @@ -99,7 +96,6 @@ public class BlockList {
Blocks.STRIPPED_DARK_OAK_LOG,
Blocks.STRIPPED_CRIMSON_STEM,
Blocks.STRIPPED_WARPED_STEM,
Blocks.STRIPPED_MANGROVE_LOG,
Blocks.OAK_PLANKS,
Blocks.SPRUCE_PLANKS,
Blocks.BIRCH_PLANKS,
Expand All @@ -108,7 +104,6 @@ public class BlockList {
Blocks.DARK_OAK_PLANKS,
Blocks.CRIMSON_PLANKS,
Blocks.WARPED_PLANKS,
Blocks.MANGROVE_PLANKS,
Blocks.OAK_WOOD,
Blocks.SPRUCE_WOOD,
Blocks.BIRCH_WOOD,
Expand All @@ -117,7 +112,6 @@ public class BlockList {
Blocks.DARK_OAK_WOOD,
Blocks.CRIMSON_HYPHAE,
Blocks.WARPED_HYPHAE,
Blocks.MANGROVE_WOOD,
Blocks.STRIPPED_OAK_WOOD,
Blocks.STRIPPED_SPRUCE_WOOD,
Blocks.STRIPPED_BIRCH_WOOD,
Expand All @@ -126,7 +120,6 @@ public class BlockList {
Blocks.STRIPPED_DARK_OAK_WOOD,
Blocks.STRIPPED_CRIMSON_HYPHAE,
Blocks.STRIPPED_WARPED_HYPHAE,
Blocks.STRIPPED_MANGROVE_WOOD,
Blocks.OAK_SLAB,
Blocks.SPRUCE_SLAB,
Blocks.BIRCH_SLAB,
Expand All @@ -135,14 +128,12 @@ public class BlockList {
Blocks.DARK_OAK_SLAB,
Blocks.CRIMSON_SLAB,
Blocks.WARPED_SLAB,
Blocks.MANGROVE_SLAB,
Blocks.OAK_STAIRS,
Blocks.SPRUCE_STAIRS,
Blocks.BIRCH_STAIRS,
Blocks.JUNGLE_STAIRS,
Blocks.ACACIA_STAIRS,
Blocks.DARK_OAK_STAIRS,
Blocks.CRIMSON_STAIRS,
Blocks.WARPED_STAIRS,
Blocks.MANGROVE_STAIRS);
Blocks.WARPED_STAIRS);
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private void dispenseCustomBehaviorEmptyItemStack(ServerWorld serverWorld,
}

// Assign a random empty slot the result ItemStack
int slot = serverWorld.random.nextBetween(0, dispenserBlockEntity.size() - 1);
int slot = serverWorld.random.nextInt(0, dispenserBlockEntity.size());
ItemStack resultStack = customBehavior.dispense(blockPointer, itemStack);
dispenserBlockEntity.setStack(slot, resultStack);
ci.cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.world.SpawnHelper;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeKeys;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import net.minecraft.block.entity.EndGatewayBlockEntity;
import net.minecraft.entity.MovementType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.registry.RegistryKey;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,31 @@
package gillycarpetaddons.ruleobservers;

import carpet.CarpetSettings;
import carpet.api.settings.CarpetRule;
import carpet.api.settings.InvalidRuleValueException;
import carpet.api.settings.SettingsManager;
import carpet.settings.ParsedRule;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.text.Text;
import org.apache.logging.log4j.util.TriConsumer;

import java.util.Objects;

public final class movableSpawnerRuleObserver implements SettingsManager.RuleObserver {
public final class movableSpawnerRuleObserver implements TriConsumer<ServerCommandSource, ParsedRule<?>, String> {
@Override
public void ruleChanged(ServerCommandSource source, CarpetRule<?> changedRule, String userInput) {
try {
// Using a string here directly feels wrong but likelihood of renaming this rule is low
if (!Objects.equals(changedRule.name(), "movableSpawners")) {
return;
}

boolean ruleEnabled = (boolean) changedRule.value();
if (!ruleEnabled) {
return;
}

if (CarpetSettings.movableBlockEntities) {
return;
}
public void accept(ServerCommandSource source, ParsedRule<?> rule, String userTypedValue) {
// Using a string here directly feels wrong but likelihood of renaming this rule is low
if (!Objects.equals(rule.name, "movableSpawners")) {
return;
}

source.sendError(Text.of("The carpet rule 'movableBlockEntities' must be enabled to use this rule!"));
changedRule.set(source, String.valueOf(false));
boolean ruleEnabled = rule.getBoolValue();
if (!ruleEnabled) {
return;
}
catch (InvalidRuleValueException e) {
e.notifySource(changedRule.name(), source);

if (CarpetSettings.movableBlockEntities) {
return;
}

source.sendError(Text.of("The carpet rule 'movableBlockEntities' must be enabled to use this rule!"));
rule.set(source, String.valueOf(false));
}
}
}
20 changes: 0 additions & 20 deletions src/main/resources/assets/gilly7ce-carpet-addons/lang/en_us.json

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
],
"depends": {
"fabricloader": ">=0.14.19",
"minecraft": "1.19.*",
"minecraft": "1.18.2",
"java": ">=17",
"carpet": ">=1.4.96"
"carpet": ">=1.4.69"
},
"suggests": {},
"custom": {
Expand Down

0 comments on commit f85e5a0

Please sign in to comment.