Permalink
Browse files

Fix a lot of container updates.

  • Loading branch information...
me4502 committed Aug 22, 2017
1 parent 7217cdb commit 4ae9d1d4ea9c85578186bba16785a3be8cdb195e
@@ -320,7 +320,7 @@ public static boolean copyData(Block from, Block to) {
if (fromState instanceof InventoryHolder) {
oldInventory = ((InventoryHolder) fromState).getInventory().getContents().clone();
((InventoryHolder) fromState).getInventory().clear();
fromState.update();
//fromState.update();
from.setTypeId(0);
}
to.setTypeIdAndData(type, data, true);
@@ -337,7 +337,7 @@ public static boolean copyData(Block from, Block to) {
toState.update();
} else if (toState instanceof InventoryHolder) {
((InventoryHolder) toState).getInventory().setContents(oldInventory);
toState.update(true);
//toState.update(true);
}
return true;
@@ -157,7 +157,7 @@ public void onThink(SelfTriggerThinkEvent event) {
ItemStack toRemove = i.clone();
toRemove.setAmount(1);
inventory.removeItem(toRemove);
chest.update();
// chest.update(); Oii
lastTick -= 50;
break;
}
@@ -1,19 +1,18 @@
package com.sk89q.craftbook.mechanics.ic.gates.world.blocks;
import java.util.Locale;
import com.sk89q.craftbook.ChangedSign;
import com.sk89q.craftbook.mechanics.ic.AbstractSelfTriggeredIC;
import com.sk89q.craftbook.mechanics.ic.ChipState;
import com.sk89q.craftbook.mechanics.ic.ICFactory;
import com.sk89q.craftbook.util.ItemInfo;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.Chest;
import org.bukkit.inventory.ItemStack;
import com.sk89q.craftbook.ChangedSign;
import com.sk89q.craftbook.mechanics.ic.AbstractSelfTriggeredIC;
import com.sk89q.craftbook.mechanics.ic.ChipState;
import com.sk89q.craftbook.mechanics.ic.ICFactory;
import com.sk89q.craftbook.util.ItemInfo;
import java.util.Locale;
public abstract class SetBlock extends AbstractSelfTriggeredIC {
@@ -82,7 +81,7 @@ public boolean takeFromChest(Block bl, ItemInfo item) {
stack.setAmount(stack.getAmount() - 1);
}
c.getInventory().setContents(is);
c.update();
//c.update();
return true;
}
}
@@ -16,18 +16,6 @@
package com.sk89q.craftbook.mechanics.ic.gates.world.entity;
import java.util.Locale;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Skeleton;
import org.bukkit.inventory.ItemStack;
import com.sk89q.craftbook.ChangedSign;
import com.sk89q.craftbook.mechanics.ic.AbstractIC;
import com.sk89q.craftbook.mechanics.ic.AbstractICFactory;
@@ -39,6 +27,17 @@
import com.sk89q.craftbook.util.EntityUtil;
import com.sk89q.craftbook.util.LocationUtil;
import com.sk89q.craftbook.util.RegexUtil;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Skeleton;
import org.bukkit.inventory.ItemStack;
import java.util.Locale;
public class CreatureSpawner extends AbstractIC {
@@ -96,7 +95,7 @@ public void trigger(ChipState chip) {
org.bukkit.block.CreatureSpawner sp = (org.bukkit.block.CreatureSpawner) center.getRelative(0, 1,
0).getState();
sp.setCreatureTypeByName(type.getName());
sp.setSpawnedType(type);
sp.update();
} else {
Location loc = LocationUtil.getCenterOfBlock(LocationUtil.getNextFreeSpace(center, BlockFace.UP));
@@ -1,17 +1,5 @@
package com.sk89q.craftbook.mechanics.ic.gates.world.items;
import java.util.ArrayList;
import java.util.Collections;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import com.sk89q.craftbook.ChangedSign;
import com.sk89q.craftbook.bukkit.util.BukkitUtil;
import com.sk89q.craftbook.mechanics.ic.AbstractICFactory;
@@ -25,6 +13,16 @@
import com.sk89q.craftbook.util.InventoryUtil;
import com.sk89q.craftbook.util.ItemSyntax;
import com.sk89q.craftbook.util.SignUtil;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.Collections;
public class ContainerStocker extends AbstractSelfTriggeredIC {
@@ -86,8 +84,7 @@ public boolean stock() {
InventoryHolder c = (InventoryHolder) offset.getBlock().getState();
for(ItemStack stack : event.getItems())
if (c.getInventory().addItem(stack).isEmpty()) {
if(c instanceof BlockState)
((BlockState) c).update();
//((BlockState) c).update();
return true;
}
}
@@ -1,17 +1,5 @@
package com.sk89q.craftbook.mechanics.minecart.blocks;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.bukkit.block.Chest;
import org.bukkit.entity.minecart.StorageMinecart;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import com.sk89q.craftbook.bukkit.CraftBookPlugin;
import com.sk89q.craftbook.mechanics.minecart.events.CartBlockImpactEvent;
import com.sk89q.craftbook.util.ItemInfo;
@@ -21,6 +9,17 @@
import com.sk89q.craftbook.util.RegexUtil;
import com.sk89q.craftbook.util.Tuple2;
import com.sk89q.util.yaml.YAMLProcessor;
import org.bukkit.block.Chest;
import org.bukkit.entity.minecart.StorageMinecart;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
public class CartDeposit extends CartBlockMechanism {
@@ -129,7 +128,7 @@ public void onVehicleImpact(CartBlockImpactEvent event) {
transferItems.addAll(leftovers);
leftovers.clear();
container.update();
//container.update();
}
CraftBookPlugin.logDebugMessage("collected items. " + transferItems.size() + " stacks left over.", "cart-deposit.collect");
@@ -178,7 +177,7 @@ public void onVehicleImpact(CartBlockImpactEvent event) {
transferitems.addAll(Arrays.asList(containerinventory.getContents()));
containerinventory.clear();
}
container.update();
// container.update();
}
transferitems.removeAll(Collections.singleton(null));

0 comments on commit 4ae9d1d

Please sign in to comment.