Slime block compatibility.
This commit is contained in:
parent
8cfc3b7f01
commit
b2e154be45
2 changed files with 17 additions and 15 deletions
2
pom.xml
2
pom.xml
|
@ -9,7 +9,7 @@
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<plib.version>1.4-SNAPSHOT</plib.version>
|
<plib.version>1.4-SNAPSHOT</plib.version>
|
||||||
<bukkit.version>1.9-SNAPSHOT</bukkit.version>
|
<bukkit.version>1.9.4-R0.1-SNAPSHOT</bukkit.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package de.jaschastarke.minecraft.limitedcreative.blockstate;
|
package de.jaschastarke.minecraft.limitedcreative.blockstate;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -144,19 +143,15 @@ public class BlockListener implements Listener {
|
||||||
return;
|
return;
|
||||||
event.getBlock().setMetadata("LCBS_pistonIsAlreadyExtended", blockAlreadExtended);
|
event.getBlock().setMetadata("LCBS_pistonIsAlreadyExtended", blockAlreadExtended);
|
||||||
|
|
||||||
Block source = event.getBlock().getRelative(event.getDirection());
|
|
||||||
/*if (mod.isDebug())
|
/*if (mod.isDebug())
|
||||||
mod.getLog().debug("PistonExtend "+source.getType()+" "+source.getLocation()+" "+event.getDirection());*/
|
mod.getLog().debug("PistonExtend "+source.getType()+" "+source.getLocation()+" "+event.getDirection());*/
|
||||||
|
|
||||||
List<Block> movedBlocks = new ArrayList<Block>();
|
List<Block> movedBlocks = event.getBlocks();
|
||||||
while (source != null && source.getType() != Material.AIR) {
|
|
||||||
movedBlocks.add(0, source); // put on top, so iterating the
|
|
||||||
source = source.getRelative(event.getDirection());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (movedBlocks.size() > 0) {
|
if (movedBlocks.size() > 0) {
|
||||||
DBTransaction update = mod.getModel().groupUpdate();
|
DBTransaction update = mod.getModel().groupUpdate();
|
||||||
for (Block sblock : movedBlocks) {
|
for(int count = movedBlocks.size()-1; count >= 0; count--){
|
||||||
|
Block sblock = movedBlocks.get(count);
|
||||||
Block dest = sblock.getRelative(event.getDirection());
|
Block dest = sblock.getRelative(event.getDirection());
|
||||||
if (mod.isDebug())
|
if (mod.isDebug())
|
||||||
mod.getLog().debug("PistionExtend moves "+sblock.getType()+"-Block from "+sblock.getLocation()+" to "+dest.getLocation());
|
mod.getLog().debug("PistionExtend moves "+sblock.getType()+"-Block from "+sblock.getLocation()+" to "+dest.getLocation());
|
||||||
|
@ -173,12 +168,19 @@ public class BlockListener implements Listener {
|
||||||
return;
|
return;
|
||||||
event.getBlock().removeMetadata("LCBS_pistonIsAlreadyExtended", mod.getPlugin());
|
event.getBlock().removeMetadata("LCBS_pistonIsAlreadyExtended", mod.getPlugin());
|
||||||
|
|
||||||
Block dest = event.getBlock().getRelative(event.getDirection());
|
List<Block> movedBlocks = event.getBlocks();
|
||||||
Block source = dest.getRelative(event.getDirection());
|
if(movedBlocks.size() > 0)
|
||||||
if (event.isSticky() && source.getType() != Material.AIR) {
|
{
|
||||||
|
DBTransaction update = mod.getModel().groupUpdate();
|
||||||
|
for(int count = movedBlocks.size()-1; count >= 0; count--){
|
||||||
|
Block sblock = movedBlocks.get(count);
|
||||||
|
Block dest = sblock.getRelative(event.getDirection());
|
||||||
if (mod.isDebug())
|
if (mod.isDebug())
|
||||||
mod.getLog().debug("PistionRetract moves "+source.getType()+"-Block from "+source.getLocation()+" to "+dest.getLocation());
|
mod.getLog().debug("PistionRetract moves "+sblock.getType()+"-Block from "+sblock.getLocation()+" to "+dest.getLocation());
|
||||||
mod.getModel().moveState(source, source.getRelative(event.getDirection().getOppositeFace()));
|
|
||||||
|
update.moveState(sblock, dest);
|
||||||
|
}
|
||||||
|
update.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue