mirror of
https://github.com/taoneill/war.git
synced 2024-11-13 05:54:31 +01:00
More resetwarzone madness.
This commit is contained in:
parent
f76419a4b9
commit
cd6c4fc10a
@ -162,11 +162,11 @@ public class Warzone {
|
||||
int x = (int)northwest.getBlockX() - 2;
|
||||
int minY = 0;
|
||||
int maxY = 128;
|
||||
for(int i = 0; i < northSouth + 3 && i < getInitialState().length; i++){
|
||||
for(int i = 0; i < northSouth + 3; i++){
|
||||
int y = minY;
|
||||
for(int j = 0; j < 128 && j < getInitialState()[i].length; j++) {
|
||||
for(int j = 0; j < 128; j++) {
|
||||
int z = (int)southeast.getBlockZ() - 2;
|
||||
for(int k = 0; k < eastWest + 3 && k < getInitialState()[i][j].length; k++) {
|
||||
for(int k = 0; k < eastWest + 3; k++) {
|
||||
getInitialState()[i][j][k] = world.getBlockAt(x, y, z).getTypeID();
|
||||
noOfSavedBlocks++;
|
||||
z++;
|
||||
@ -196,18 +196,18 @@ public class Warzone {
|
||||
int x = northwest.getBlockX() - 2;
|
||||
int minY = 0;
|
||||
int maxY = 128;
|
||||
for(int i = 0; i < northSouth + 3 && i < getInitialState().length; i++){
|
||||
for(int i = 0; i < northSouth + 3; i++){
|
||||
int y = minY;
|
||||
for(int j = 0; j < 128 && j < getInitialState()[i].length; j++) {
|
||||
for(int j = 0; j < 128; j++) {
|
||||
int z = (int)southeast.getBlockZ() - 2;
|
||||
for(int k = 0; k < eastWest + 3 && k < getInitialState()[i][j].length; k++) {
|
||||
for(int k = 0; k < eastWest + 3; k++) {
|
||||
Block currentBlock = world.getBlockAt(x, y, z);
|
||||
int currentType = currentBlock.getTypeID();
|
||||
int initialType = getInitialState()[i][j][k];
|
||||
if(currentType != initialType) { // skip block if nothing changed
|
||||
currentBlock.setTypeID(initialType);
|
||||
noOfResetBlocks++;
|
||||
}
|
||||
noOfResetBlocks++;
|
||||
z++;
|
||||
}
|
||||
y++;
|
||||
|
@ -133,13 +133,9 @@ public class WarzoneMapper {
|
||||
String[] stateStrSplit = stateStr.split(",");
|
||||
int splitIndex = 0;
|
||||
if(stateStrSplit.length > 1000) {
|
||||
for(int i = 0; i < northSouth + 3
|
||||
&& i < state.length; i++){
|
||||
for(int j = 0; j < maxY - minY
|
||||
&& j < state[i].length; j++) {
|
||||
for(int k = 0; k < eastWest + 3
|
||||
&& k < state[k].length
|
||||
&& splitIndex < stateStrSplit.length; k++) {
|
||||
for(int i = 0; i < northSouth + 3; i++){
|
||||
for(int j = 0; j < 128; j++) {
|
||||
for(int k = 0; k < eastWest + 3; k++) {
|
||||
String currentBlockType = stateStrSplit[splitIndex];
|
||||
if(currentBlockType != null && !currentBlockType.equals("")) {
|
||||
state[i][j][k] = Integer.parseInt(currentBlockType);
|
||||
@ -260,15 +256,15 @@ public class WarzoneMapper {
|
||||
if(saveBlocks) {
|
||||
// zone blocks
|
||||
PropertiesFile warzoneBlocksFile = new PropertiesFile(war.getName() + "/warzone-" + warzone.getName() + ".dat");
|
||||
int northSouth = ((int)(warzone.getSoutheast().getBlockX())) - ((int)(warzone.getNorthwest().getBlockX()));
|
||||
int eastWest = ((int)(warzone.getNorthwest().getBlockZ())) - ((int)(warzone.getSoutheast().getBlockZ()));
|
||||
int northSouth = warzone.getSoutheast().getBlockX() - warzone.getNorthwest().getBlockX();
|
||||
int eastWest = warzone.getNorthwest().getBlockZ() - warzone.getSoutheast().getBlockZ();
|
||||
int[][][] state = warzone.getInitialState();
|
||||
StringBuilder stateBuilder = new StringBuilder();
|
||||
int savedBlocks = 0;
|
||||
if(state.length > 1) {
|
||||
for(int i = 0; i < northSouth + 3 && i < state.length; i++){
|
||||
for(int j = 0; j < 128 && j < state[i].length; j++) {
|
||||
for(int k = 0; k < eastWest + 3 && k < state[i][j].length && savedBlocks < state.length; k++) {
|
||||
for(int i = 0; i < northSouth + 3; i++){
|
||||
for(int j = 0; j < 128; j++) {
|
||||
for(int k = 0; k < eastWest + 3; k++) {
|
||||
stateBuilder.append(state[i][j][k] + ",");
|
||||
savedBlocks++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user