Skip to content

Commit

Permalink
strip out users ability to drop on the ground
Browse files Browse the repository at this point in the history
  • Loading branch information
Lothrazar committed Apr 6, 2024
1 parent 2e40cbf commit 827a6a9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
15 changes: 0 additions & 15 deletions src/main/java/com/lothrazar/cyclic/base/TileEntityBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
import com.lothrazar.cyclic.util.UtilEntity;
import com.lothrazar.cyclic.util.UtilFakePlayer;
import com.lothrazar.cyclic.util.UtilFluid;
import com.lothrazar.cyclic.util.UtilItemStack;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import net.minecraft.block.BlockState;
Expand Down Expand Up @@ -91,19 +89,6 @@ protected PlayerEntity getLookingPlayer(int maxRange, boolean mustCrouch) {
return null;
}

public void tryDumpFakePlayerInvo(WeakReference<FakePlayer> fp, boolean includeMainHand) {
int start = (includeMainHand) ? 0 : 1;
ArrayList<ItemStack> toDrop = new ArrayList<ItemStack>();
for (int i = start; i < fp.get().inventory.mainInventory.size(); i++) {
ItemStack s = fp.get().inventory.mainInventory.get(i);
if (s.isEmpty() == false) {
toDrop.add(s.copy());
fp.get().inventory.mainInventory.set(i, ItemStack.EMPTY);
}
}
UtilItemStack.drop(this.world, this.pos.up(), toDrop);
}

public static void tryEquipItem(ItemStack item, WeakReference<FakePlayer> fp, Hand hand) {
if (fp == null) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import com.google.common.collect.Maps;
import com.lothrazar.cyclic.base.TileEntityBase;
import com.lothrazar.cyclic.registry.TileRegistry;
import com.lothrazar.cyclic.util.UtilItemStack;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Map;
import java.util.UUID;
import net.minecraft.block.BlockState;
Expand Down Expand Up @@ -70,6 +72,19 @@ public void tick() {
}
}

private void tryDumpFakePlayerInvo(WeakReference<FakePlayer> fp, boolean includeMainHand) {
int start = (includeMainHand) ? 0 : 1;
ArrayList<ItemStack> toDrop = new ArrayList<ItemStack>();
for (int i = start; i < fp.get().inventory.mainInventory.size(); i++) {
ItemStack s = fp.get().inventory.mainInventory.get(i);
if (s.isEmpty() == false) {
toDrop.add(s.copy());
fp.get().inventory.mainInventory.set(i, ItemStack.EMPTY);
}
}
UtilItemStack.drop(this.world, this.pos.up(), toDrop);
}

@Override
public void setField(int field, int value) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ public void tick() {
catch (Exception e) {
ModCyclic.LOGGER.error("User action item error", e);
}
tryDumpFakePlayerInvo(fakePlayer, false);
}

public boolean isUsingLeftHand() {
Expand Down
2 changes: 1 addition & 1 deletion update.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@
,"1.5.20":"#2102 wooden and golden hopper deposit logic fixed, now matches 1.18.2+ versions. #2085 Hopper reach area & pickup logic now uses vanilla-hopper area size. JEED compatibility added for some potion effects. Port Fishing Net and Mending Fishingrods compatibility from 1.12.2 #2067. Ender Apple now sends a message if nothing is found (void/flatworlds/etc). Growth enchant now skips IGrowable blocks that return false for 'canGrow();'. Many new config options added for: growth enchant, beheading enchant, battery, sprinkler, experience_pylon, fisher, scythes, and others in cyclic.toml"
,"1.5.21":"#1933 Sack of Holding chest placement override added, with new config to revert back to legacy behavior if desired (overrideChestSingle). #2168 fix bug where ender shelf sometimes would not save contents when mined after exiting reloading world when client data desyncs. Added a percentage config and ignorelist config for cyclic:disarm enchantment (disarmPercentPerLevel, disarmIngoredMobs), resolves it dropping your copied weapon from alexsmobs:mimicube #2249. Fix #1878 layered and/or logic for multiple wireless transmitters on the same node "
,"1.5.22":"Fix #2351 advanced crafting stick not opening. "
,"1.5.23":"Growth enchantment now uses the same logic as Sprinkler & Terra Soil (only minecraft:crops or minecraft::saplings can grow, respect IGrowable::canUseBonemeal). New gloomIgnored config Gloom enchant (cyclic:curse) to ignore and not use these effects #2217 #2325. New config 'Fix Soundproofing block not muting Mekanism sounds #2389 (for example Precision Sawmill and others - you may need four or more soundproofing blocks for the desired effect). New config [cyclic.blocks.soundproofing] radius = 6 to control the area. Fix item cable routing #2245 #2230. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] zenscript support for generator_fluid and generator_item; #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+ "
,"1.5.23":"Growth enchantment now uses the same logic as Sprinkler & Terra Soil (only minecraft:crops or minecraft::saplings can grow, respect IGrowable::canUseBonemeal). New gloomIgnored config Gloom enchant (cyclic:curse) to ignore and not use these effects #2217 #2325. New config 'Fix Soundproofing block not muting Mekanism sounds #2389 (for example Precision Sawmill and others - you may need four or more soundproofing blocks for the desired effect). Patch an edge-case where User might drop items on the ground. New config [cyclic.blocks.soundproofing] radius = 6 to control the area. Fix item cable routing #2245 #2230. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] zenscript support for generator_fluid and generator_item; #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+ "
}
}

0 comments on commit 827a6a9

Please sign in to comment.