Skip to content

Commit

Permalink
block reach along with facades; facade configs
Browse files Browse the repository at this point in the history
  • Loading branch information
Lothrazar committed Oct 4, 2024
1 parent c35ddb5 commit ae64907
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 16 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ minecraft {
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
property 'forge.enabledGameTestNamespaces', mod_id
args '--username=ADev'
}

server {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ org.gradle.daemon=false

mod_id=cyclic
curse_id=239286
mod_version=1.12.13-SNAPSHOT
mod_version=1.12.14-SNAPSHOT


# NEO FORGED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public int getField(int field) {

@Override
public void load(CompoundTag tag) {
this.loadFacade(tag);
super.load(tag);
this.loadFacade(tag);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ default void loadFacade(CompoundTag compound) {
}

default void saveFacade(CompoundTag compound) {
var fac = getFacade();
if (fac != null) {
compound.put(NBT_FACADE, fac);
var facadeState = getFacade();
if (facadeState == null) {
compound.remove(NBT_FACADE);
}
else {
compound.put(NBT_FACADE, facadeState);
}
}
}
22 changes: 17 additions & 5 deletions src/main/java/com/lothrazar/cyclic/config/ConfigRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,24 @@ private static void initConfig() {
CFG.pop(); //items
CFG.comment(WALL, " Block specific configs", WALL).push("blocks"); //////////////////////////////////////////////////////////////////////////////////// blocks
CFG.push("facades");
CABLE_FACADES = CFG.comment("\r\n Allow cables to have blocks placed in them as facades (sneak-left-click to set; use empty hand to remove). False to disable")
.define("allowCableFacades", true);
CABLE_FACADES = CFG.comment("\r\n Allow cables to have blocks placed in them as facades (sneak-left-click to set; use empty hand to remove). Set to false to disable facades")
.define("enabled", true);
//a few default
List<String> list = Arrays.asList("minecraft:ladder", "minecraft:double_plant", "minecraft:waterlily");
FACADE_IGNORELIST = CFG.comment("\r\n These blocks are not allowed to be used as Facades for blocks (for example: Glowstone Facade, Soundproofing Facade and others)")
.define("FacadesDoNotUse", list);
List<String> list = Arrays.asList("minecraft:ladder", "minecraft:double_plant", "minecraft:waterlily",
"minecraft:torch", "minecraft:*_torch", "minecraft:redstone", "minecraft:iron_bars",
"minecraft:chest", "minecraft:ender_chest", "minecraft:sculk_vein", "minecraft:string", "minecraft:vine",
"minecraft:rail",
"minecraft:*_rail",
"minecraft:brewing_stand",
"minecraft:*_dripleaf",
"minecraft:*_pane",
"minecraft:*_sapling", "minecraft:*_sign",
"minecraft:*_door",
"minecraft:*_banner", "minecraft:*_shulker_box",
"cyclic:*_pipe", "cyclic:*_bars",
"storagenetwork:*");
FACADE_IGNORELIST = CFG.comment("\r\n These blocks are not allowed to be used as Facades for blocks because they look weird (used by cables and Glowstone Facade and Soundproofing Facade and others)")
.define("itemsNotAllowed", list);
//
CFG.pop();
TRANSFER_NODES_DIMENSIONAL = CFG.comment(" Allows the dimensional Transfer Nodes to cross dimensions "
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/lothrazar/cyclic/event/ItemEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,6 @@ private void onHitFacadeHandler(PlayerInteractEvent.LeftClickBlock event, Player
}
if (target.getBlock() instanceof CableBase) {
if (!ConfigRegistry.CABLE_FACADES.get()) {
ModCyclic.LOGGER.error("Config file has blocked cables from having a facade");
return;
}
}
Expand All @@ -556,11 +555,12 @@ private void onHitFacadeHandler(PlayerInteractEvent.LeftClickBlock event, Player

@OnlyIn(Dist.CLIENT)
private void onHitFacadeClient(PlayerInteractEvent.LeftClickBlock event, Player player, ItemStack held, Block block) {
BlockHitResult bhr = (BlockHitResult) player.pick(5, 1, false);
//pick the block, write to tags, and send to server
boolean pickFluids = false;
BlockHitResult bhr = (BlockHitResult) player.pick(player.getBlockReach(), 1, pickFluids);
BlockPlaceContext context = new BlockPlaceContext(player, event.getHand(), held, bhr);
BlockState facadeState = null;
facadeState = block.getStateForPlacement(context);
CompoundTag tags = NbtUtils.writeBlockState(facadeState);
BlockState facadeState = block.getStateForPlacement(context);
CompoundTag tags = (facadeState == null) ? null : NbtUtils.writeBlockState(facadeState);
PacketRegistry.INSTANCE.sendToServer(new BlockFacadeMessage(event.getPos(), tags));
}

Expand Down
2 changes: 1 addition & 1 deletion update.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,6 @@
,"1.20.11":"Fix create new world crash from previous version 'Feature order cycle found minecraft:frozen_peaks': Merge pull request #2426 from Apollounknowndev/trunk/1.20.1 "
,"1.12.12":"Added config controls to the settings in the item.laser_cannon laser beam; along with a new option to render the laser even when you miss. Battery and Claystone Battery now have their storage capacity defined in the config file. Some default config values have been changed, and upper limits have been raised. Increase capacity of the (creative) Infinite Battery. Rebalanced recipes for Breaker and Placer. Fix a bug where if the Item User is configured to consume energy, it still had the capability (connected to cables and showed RF in Jade); fixed to match behavior of other configured blocks "
,"1.12.13":"Fix Mattock not saving contents of Shulker Boxes when mined #2411. Block Reach enchantment now has max level 5 to give players more control of how far the reach boost is increased; so levels I through V are now available. Since players normally have 5 blocks of reach distance: level I reaches 8, II reaches 10, III reaches 12, IV reaches 14, and V reaches 16 blocks (+4 for anything beyond with something like apotheosis)"
,"1.13.0":"Renamed 'Concentrated Glowstone' to 'Glowstone Facade' and 'Concentrated Soundproofing' to 'Soundproofing Facade'. Fixed issues with both blocks to correctly render facades (use sneak-left-click while not in creative), and they no longer have an inventory"
,"1.12.14":"Renamed 'Concentrated Glowstone' to 'Glowstone Facade' and 'Concentrated Soundproofing' to 'Soundproofing Facade'. Fixed issues with both blocks to correctly render facades (use sneak-left-click while not in creative), and they no longer have an inventory"
}
}

0 comments on commit ae64907

Please sign in to comment.