conflict_resolution
stringlengths 27
16k
|
---|
<<<<<<<
import java.io.*;
import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.*;
import javax.lang.model.type.*;
import junitparams.testnaming.MacroSubstitutionNamingStrategy;
import junitparams.testnaming.TestCaseNamingStrategy;
import org.junit.*;
import org.junit.runner.*;
import org.junit.runners.model.*;
import junitparams.*;
import junitparams.mappers.*;
=======
import junitparams.FileParameters;
import junitparams.Parameters;
import junitparams.internal.parameters.ParametersReader;
import org.junit.Ignore;
import org.junit.runner.Description;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.TestClass;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.List;
>>>>>>>
import junitparams.FileParameters;
import junitparams.Parameters;
import junitparams.internal.parameters.ParametersReader;
import org.junit.Ignore;
import org.junit.runner.Description;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.TestClass;
import junitparams.testnaming.MacroSubstitutionNamingStrategy;
import junitparams.testnaming.TestCaseNamingStrategy;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.List;
<<<<<<<
private Parameters parametersAnnotation;
private FileParameters fileParametersAnnotation;
private TestCaseNamingStrategy namingStrategy;
private Object[] params;
=======
private ParametersReader parametersReader;
private Object[] cachedParameters;
>>>>>>>
private ParametersReader parametersReader;
private Object[] cachedParameters;
private TestCaseNamingStrategy namingStrategy;
<<<<<<<
this.parametersAnnotation = frameworkMethod.getAnnotation(Parameters.class);
this.fileParametersAnnotation = frameworkMethod.getAnnotation(FileParameters.class);
if (parametersAnnotation != null && fileParametersAnnotation != null) {
throw new IllegalArgumentException("Both @Parameters and @FileParameters exist on " + frameworkMethod.getName()
+ ". Remove one of them!");
}
namingStrategy = new MacroSubstitutionNamingStrategy(this);
=======
parametersReader = new ParametersReader(testClass(), frameworkMethod);
>>>>>>>
parametersReader = new ParametersReader(testClass(), frameworkMethod);
namingStrategy = new MacroSubstitutionNamingStrategy(this); |
<<<<<<<
=======
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.media.AudioManager;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.text.Editable;
import android.text.Html;
import android.text.TextWatcher;
import android.text.method.LinkMovementMethod;
import android.text.method.PasswordTransformationMethod;
import android.text.method.SingleLineTransformationMethod;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
>>>>>>>
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.media.AudioManager;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.text.Editable;
import android.text.Html;
import android.text.TextWatcher;
import android.text.method.LinkMovementMethod;
import android.text.method.PasswordTransformationMethod;
import android.text.method.SingleLineTransformationMethod;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
<<<<<<<
public final class SettingsActivity extends Activity {
=======
public final class SettingsActivity extends ActionBarActivity {
>>>>>>>
public final class SettingsActivity extends ActionBarActivity {
<<<<<<<
final boolean isDonate = prefs.getBoolean( ListActivity.PREF_DONATE, false);
=======
final boolean isDonate = prefs.getBoolean( ListFragment.PREF_DONATE, false);
>>>>>>>
final boolean isDonate = prefs.getBoolean( ListFragment.PREF_DONATE, false);
<<<<<<<
public void onCheckedChanged( final CompoundButton buttonView, final boolean isChecked ) {
if ( isChecked == prefs.getBoolean( ListActivity.PREF_DONATE, false) ) {
=======
public void onCheckedChanged( final CompoundButton buttonView, final boolean isChecked ) {
if ( isChecked == prefs.getBoolean( ListFragment.PREF_DONATE, false) ) {
>>>>>>>
@Override
public void onCheckedChanged( final CompoundButton buttonView, final boolean isChecked ) {
if ( isChecked == prefs.getBoolean( ListFragment.PREF_DONATE, false) ) {
<<<<<<<
public void onCheckedChanged( final CompoundButton buttonView, final boolean isChecked ) {
if ( isChecked == prefs.getBoolean( ListActivity.PREF_BE_ANONYMOUS, false) ) {
=======
public void onCheckedChanged( final CompoundButton buttonView, final boolean isChecked ) {
if ( isChecked == prefs.getBoolean( ListFragment.PREF_BE_ANONYMOUS, false) ) {
>>>>>>>
@Override
public void onCheckedChanged( final CompoundButton buttonView, final boolean isChecked ) {
if ( isChecked == prefs.getBoolean( ListFragment.PREF_BE_ANONYMOUS, false) ) {
<<<<<<<
editor.putBoolean( ListActivity.PREF_BE_ANONYMOUS, isChecked );
=======
editor.putBoolean( ListFragment.PREF_BE_ANONYMOUS, isChecked );
>>>>>>>
editor.putBoolean( ListFragment.PREF_BE_ANONYMOUS, isChecked );
<<<<<<<
editor.putBoolean( ListActivity.PREF_BE_ANONYMOUS, isChecked );
=======
editor.putBoolean( ListFragment.PREF_BE_ANONYMOUS, isChecked );
>>>>>>>
<<<<<<<
user.setText( prefs.getString( ListActivity.PREF_USERNAME, "" ) );
=======
user.setText( prefs.getString( ListFragment.PREF_USERNAME, "" ) );
>>>>>>>
user.setText( prefs.getString( ListFragment.PREF_USERNAME, "" ) );
<<<<<<<
pass.setText( prefs.getString( ListActivity.PREF_PASSWORD, "" ) );
=======
pass.setText( prefs.getString( ListFragment.PREF_PASSWORD, "" ) );
>>>>>>>
pass.setText( prefs.getString( ListFragment.PREF_PASSWORD, "" ) );
<<<<<<<
tv.setText( getString(R.string.setting_high_up) + " " + prefs.getLong( ListActivity.PREF_DB_MARKER, 0L ) );
=======
tv.setText( getString(R.string.setting_high_up) + " " + prefs.getLong( ListFragment.PREF_DB_MARKER, 0L ) );
>>>>>>>
tv.setText( getString(R.string.setting_high_up) + " " + prefs.getLong( ListFragment.PREF_DB_MARKER, 0L ) );
<<<<<<<
@Override
public void execute() {
editor.putLong( ListActivity.PREF_DB_MARKER, 0L );
=======
public void execute() {
editor.putLong( ListFragment.PREF_DB_MARKER, 0L );
>>>>>>>
public void execute() {
editor.putLong( ListFragment.PREF_DB_MARKER, 0L );
<<<<<<<
doScanSpinner( R.id.periodstill_spinner,
ListActivity.PREF_SCAN_PERIOD_STILL, ListActivity.SCAN_STILL_DEFAULT, getString(R.string.nonstop) );
doScanSpinner( R.id.period_spinner,
ListActivity.PREF_SCAN_PERIOD, ListActivity.SCAN_DEFAULT, getString(R.string.nonstop) );
doScanSpinner( R.id.periodfast_spinner,
ListActivity.PREF_SCAN_PERIOD_FAST, ListActivity.SCAN_FAST_DEFAULT, getString(R.string.nonstop) );
doScanSpinner( R.id.gps_spinner,
ListActivity.GPS_SCAN_PERIOD, ListActivity.LOCATION_UPDATE_INTERVAL, getString(R.string.setting_tie_wifi) );
MainActivity.prefBackedCheckBox(this, R.id.edit_showcurrent, ListActivity.PREF_SHOW_CURRENT, true);
MainActivity.prefBackedCheckBox(this, R.id.use_metric, ListActivity.PREF_METRIC, false);
MainActivity.prefBackedCheckBox(this, R.id.found_sound, ListActivity.PREF_FOUND_SOUND, true);
MainActivity.prefBackedCheckBox(this, R.id.found_new_sound, ListActivity.PREF_FOUND_NEW_SOUND, true);
MainActivity.prefBackedCheckBox(this, R.id.speech_gps, ListActivity.PREF_SPEECH_GPS, true);
MainActivity.prefBackedCheckBox(this, R.id.circle_size_map, ListActivity.PREF_CIRCLE_SIZE_MAP, false);
MainActivity.prefBackedCheckBox(this, R.id.use_network_location, ListActivity.PREF_USE_NETWORK_LOC, false);
MainActivity.prefBackedCheckBox(this, R.id.use_wigle_tiles, ListActivity.PREF_USE_WIGLE_TILES, false);
=======
doScanSpinner( R.id.periodstill_spinner,
ListFragment.PREF_SCAN_PERIOD_STILL, MainActivity.SCAN_STILL_DEFAULT, getString(R.string.nonstop) );
doScanSpinner( R.id.period_spinner,
ListFragment.PREF_SCAN_PERIOD, MainActivity.SCAN_DEFAULT, getString(R.string.nonstop) );
doScanSpinner( R.id.periodfast_spinner,
ListFragment.PREF_SCAN_PERIOD_FAST, MainActivity.SCAN_FAST_DEFAULT, getString(R.string.nonstop) );
doScanSpinner( R.id.gps_spinner,
ListFragment.GPS_SCAN_PERIOD, MainActivity.LOCATION_UPDATE_INTERVAL, getString(R.string.setting_tie_wifi) );
MainActivity.prefBackedCheckBox(this, R.id.edit_showcurrent, ListFragment.PREF_SHOW_CURRENT, true);
MainActivity.prefBackedCheckBox(this, R.id.use_metric, ListFragment.PREF_METRIC, false);
MainActivity.prefBackedCheckBox(this, R.id.found_sound, ListFragment.PREF_FOUND_SOUND, true);
MainActivity.prefBackedCheckBox(this, R.id.found_new_sound, ListFragment.PREF_FOUND_NEW_SOUND, true);
MainActivity.prefBackedCheckBox(this, R.id.speech_gps, ListFragment.PREF_SPEECH_GPS, true);
MainActivity.prefBackedCheckBox(this, R.id.circle_size_map, ListFragment.PREF_CIRCLE_SIZE_MAP, false);
MainActivity.prefBackedCheckBox(this, R.id.use_network_location, ListFragment.PREF_USE_NETWORK_LOC, false);
MainActivity.prefBackedCheckBox(this, R.id.use_wigle_tiles, ListFragment.PREF_USE_WIGLE_TILES, false);
>>>>>>>
doScanSpinner( R.id.periodstill_spinner,
ListFragment.PREF_SCAN_PERIOD_STILL, MainActivity.SCAN_STILL_DEFAULT, getString(R.string.nonstop) );
doScanSpinner( R.id.period_spinner,
ListFragment.PREF_SCAN_PERIOD, MainActivity.SCAN_DEFAULT, getString(R.string.nonstop) );
doScanSpinner( R.id.periodfast_spinner,
ListFragment.PREF_SCAN_PERIOD_FAST, MainActivity.SCAN_FAST_DEFAULT, getString(R.string.nonstop) );
doScanSpinner( R.id.gps_spinner,
ListFragment.GPS_SCAN_PERIOD, MainActivity.LOCATION_UPDATE_INTERVAL, getString(R.string.setting_tie_wifi) );
MainActivity.prefBackedCheckBox(this, R.id.edit_showcurrent, ListFragment.PREF_SHOW_CURRENT, true);
MainActivity.prefBackedCheckBox(this, R.id.use_metric, ListFragment.PREF_METRIC, false);
MainActivity.prefBackedCheckBox(this, R.id.found_sound, ListFragment.PREF_FOUND_SOUND, true);
MainActivity.prefBackedCheckBox(this, R.id.found_new_sound, ListFragment.PREF_FOUND_NEW_SOUND, true);
MainActivity.prefBackedCheckBox(this, R.id.speech_gps, ListFragment.PREF_SPEECH_GPS, true);
MainActivity.prefBackedCheckBox(this, R.id.circle_size_map, ListFragment.PREF_CIRCLE_SIZE_MAP, false);
MainActivity.prefBackedCheckBox(this, R.id.use_network_location, ListFragment.PREF_USE_NETWORK_LOC, false);
MainActivity.prefBackedCheckBox(this, R.id.use_wigle_tiles, ListFragment.PREF_USE_WIGLE_TILES, false);
<<<<<<<
doSpinner( R.id.language_spinner, ListActivity.PREF_LANGUAGE, "", languages, languageName );
=======
doSpinner( R.id.language_spinner, ListFragment.PREF_LANGUAGE, "", languages, languageName );
>>>>>>>
doSpinner( R.id.language_spinner, ListFragment.PREF_LANGUAGE, "", languages, languageName );
<<<<<<<
doSpinner( R.id.speak_spinner,
ListActivity.PREF_SPEECH_PERIOD, ListActivity.DEFAULT_SPEECH_PERIOD, speechPeriods, speechName );
=======
doSpinner( R.id.speak_spinner,
ListFragment.PREF_SPEECH_PERIOD, MainActivity.DEFAULT_SPEECH_PERIOD, speechPeriods, speechName );
>>>>>>>
doSpinner( R.id.speak_spinner,
ListFragment.PREF_SPEECH_PERIOD, MainActivity.DEFAULT_SPEECH_PERIOD, speechPeriods, speechName );
<<<<<<<
doSpinner( R.id.battery_kill_spinner,
ListActivity.PREF_BATTERY_KILL_PERCENT, ListActivity.DEFAULT_BATTERY_KILL_PERCENT, batteryPeriods, batteryName );
=======
doSpinner( R.id.battery_kill_spinner,
ListFragment.PREF_BATTERY_KILL_PERCENT, MainActivity.DEFAULT_BATTERY_KILL_PERCENT, batteryPeriods, batteryName );
>>>>>>>
doSpinner( R.id.battery_kill_spinner,
ListFragment.PREF_BATTERY_KILL_PERCENT, MainActivity.DEFAULT_BATTERY_KILL_PERCENT, batteryPeriods, batteryName );
<<<<<<<
doSpinner( R.id.reset_wifi_spinner,
ListActivity.PREF_RESET_WIFI_PERIOD, ListActivity.DEFAULT_RESET_WIFI_PERIOD, resetPeriods, resetName );
=======
doSpinner( R.id.reset_wifi_spinner,
ListFragment.PREF_RESET_WIFI_PERIOD, MainActivity.DEFAULT_RESET_WIFI_PERIOD, resetPeriods, resetName );
>>>>>>>
doSpinner( R.id.reset_wifi_spinner,
ListFragment.PREF_RESET_WIFI_PERIOD, MainActivity.DEFAULT_RESET_WIFI_PERIOD, resetPeriods, resetName );
<<<<<<<
ListActivity.info( "resume settings." );
final SharedPreferences prefs = this.getSharedPreferences( ListActivity.SHARED_PREFS, 0);
=======
MainActivity.info( "resume settings." );
final SharedPreferences prefs = this.getSharedPreferences( ListFragment.SHARED_PREFS, 0);
>>>>>>>
MainActivity.info( "resume settings." );
final SharedPreferences prefs = this.getSharedPreferences( ListFragment.SHARED_PREFS, 0);
<<<<<<<
final SharedPreferences prefs = this.getSharedPreferences( ListActivity.SHARED_PREFS, 0);
=======
final SharedPreferences prefs = this.getSharedPreferences( ListFragment.SHARED_PREFS, 0);
>>>>>>>
final SharedPreferences prefs = this.getSharedPreferences( ListFragment.SHARED_PREFS, 0);
<<<<<<<
MenuItem item = menu.add(0, MENU_RETURN, 0, getString(R.string.menu_return));
item.setIcon( android.R.drawable.ic_media_previous );
item = menu.add( 0, MENU_ERROR_REPORT, 0, getString(R.string.menu_error_report) );
=======
MenuItem item = menu.add( 0, MENU_ERROR_REPORT, 0, getString(R.string.menu_error_report) );
>>>>>>>
MenuItem item = menu.add( 0, MENU_ERROR_REPORT, 0, getString(R.string.menu_error_report) );
<<<<<<<
=======
item = menu.add(0, MENU_RETURN, 0, getString(R.string.menu_return));
item.setIcon( android.R.drawable.ic_media_previous );
>>>>>>>
item = menu.add(0, MENU_RETURN, 0, getString(R.string.menu_return));
item.setIcon( android.R.drawable.ic_media_previous ); |
<<<<<<<
String VERSION = AndGMXsms.me.getResources().getString(R.string.app_version);
String VENDOR = AndGMXsms.me.getResources().getString(R.string.author1);
this.publishProgress((Boolean) null);
XMLRPCClient client = new XMLRPCClient("https://samurai.sipgate.net/RPC2");
client.setBasicAuthentication(AndGMXsms.prefsUserSipgate, AndGMXsms.prefsPasswordSipgate);
=======
>>>>>>>
<<<<<<<
AndGMXsms.sendMessage(AndGMXsms.MESSAGE_DISPLAY_ADS, null);
String VERSION = AndGMXsms.me.getResources().getString(R.string.app_version);
String VENDOR = AndGMXsms.me.getResources().getString(R.string.author1);
=======
>>>>>>> |
<<<<<<<
this.setForeground(false);
=======
// set background
try {
new HelperAPI5().stopForeground(this, true);
} catch (VerifyError e) {
Log.d(TAG, "no api5 running");
}
>>>>>>>
this.setForeground(false);
// set background
try {
new HelperAPI5().stopForeground(this, true);
} catch (VerifyError e) {
Log.d(TAG, "no api5 running");
}
<<<<<<<
this.setForeground(true);
=======
try {
new HelperAPI5().startForeground(this, NOTIFICATION_PENDING,
notification);
} catch (VerifyError e) {
Log.d(TAG, "no api5 running");
}
>>>>>>>
this.setForeground(true);
try {
new HelperAPI5().startForeground(this, NOTIFICATION_PENDING,
notification);
} catch (VerifyError e) {
Log.d(TAG, "no api5 running");
} |
<<<<<<<
import de.lmu.ifi.dbs.elki.utilities.datastructures.BitsUtil;
=======
import de.lmu.ifi.dbs.elki.utilities.Alias;
import de.lmu.ifi.dbs.elki.utilities.BitsUtil;
>>>>>>>
import de.lmu.ifi.dbs.elki.utilities.Alias;
import de.lmu.ifi.dbs.elki.utilities.datastructures.BitsUtil; |
<<<<<<<
=======
import de.lmu.ifi.dbs.elki.utilities.Alias;
import de.lmu.ifi.dbs.elki.utilities.DatabaseUtil;
>>>>>>>
import de.lmu.ifi.dbs.elki.utilities.Alias; |
<<<<<<<
import de.lmu.ifi.dbs.elki.utilities.datastructures.BitsUtil;
=======
import de.lmu.ifi.dbs.elki.utilities.Alias;
import de.lmu.ifi.dbs.elki.utilities.BitsUtil;
>>>>>>>
import de.lmu.ifi.dbs.elki.utilities.Alias;
import de.lmu.ifi.dbs.elki.utilities.datastructures.BitsUtil; |
<<<<<<<
private static ThreadLocal<Searcher> searcher = new ThreadLocal<>();
=======
private static final Log LOG = LoggerFactory.getLogger(ElasticSearchProcedures.class);
>>>>>>>
private static final Log LOG = LoggerFactory.getLogger(ElasticSearchProcedures.class);
private static ThreadLocal<Searcher> searcher = new ThreadLocal<>(); |
<<<<<<<
public static final int DEFAULT_READ_TIMEOUT = 3000; //3s
public static final int DEFAULT_CONNECTION_TIMEOUT = 3000; //3s
=======
public static final int DEFAULT_MAX_CONSECUTIVE_ERRORS = 5;
>>>>>>>
public static final int DEFAULT_READ_TIMEOUT = 3000; //3s
public static final int DEFAULT_CONNECTION_TIMEOUT = 3000; //3s
public static final int DEFAULT_MAX_CONSECUTIVE_ERRORS = 5;
<<<<<<<
return new ElasticSearchConfiguration(inclusionPolicies, initializeUntil, getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), DEFAULT_AUTH_USER, DEFAULT_AUTH_PASSWORD, getMapping(), isAsyncIndexation(), getReadTimeout(), getConnectionTimeout());
=======
return new ElasticSearchConfiguration(inclusionPolicies, initializeUntil, getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), DEFAULT_AUTH_USER, DEFAULT_AUTH_PASSWORD, getMapping(), isAsyncIndexation());
>>>>>>>
return new ElasticSearchConfiguration(inclusionPolicies, initializeUntil, getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), DEFAULT_AUTH_USER, DEFAULT_AUTH_PASSWORD, getMapping(), isAsyncIndexation(), getReadTimeout(), getConnectionTimeout());
<<<<<<<
return new ElasticSearchConfiguration(DEFAULT_INCLUSION_POLICIES, NEVER, DEFAULT_PROTOCOL, null, null, DEFAULT_KEY_PROPERTY, DEFAULT_RETRY_ON_ERROR, DEFAULT_QUEUE_CAPACITY, DEFAULT_REINDEX_BATCH_SIZE, DEFAULT_EXECUTE_BULK, DEFAULT_AUTH_USER, DEFAULT_AUTH_PASSWORD, DEFAULT_MAPPING, DEFAULT_ASYNC_INDEXATION, DEFAULT_READ_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT);
=======
return new ElasticSearchConfiguration(DEFAULT_INCLUSION_POLICIES, NEVER, DEFAULT_PROTOCOL, null, null, DEFAULT_KEY_PROPERTY, DEFAULT_RETRY_ON_ERROR, DEFAULT_MAX_CONSECUTIVE_ERRORS, DEFAULT_QUEUE_CAPACITY, DEFAULT_REINDEX_BATCH_SIZE, DEFAULT_EXECUTE_BULK, DEFAULT_AUTH_USER, DEFAULT_AUTH_PASSWORD, DEFAULT_MAPPING, DEFAULT_ASYNC_INDEXATION);
>>>>>>>
return new ElasticSearchConfiguration(DEFAULT_INCLUSION_POLICIES, NEVER, DEFAULT_PROTOCOL, null, null, DEFAULT_KEY_PROPERTY, DEFAULT_RETRY_ON_ERROR, DEFAULT_MAX_CONSECUTIVE_ERRORS, DEFAULT_QUEUE_CAPACITY, DEFAULT_REINDEX_BATCH_SIZE, DEFAULT_EXECUTE_BULK, DEFAULT_AUTH_USER, DEFAULT_AUTH_PASSWORD, DEFAULT_MAPPING, DEFAULT_ASYNC_INDEXATION, DEFAULT_READ_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT);
<<<<<<<
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), protocol, getUri(), getPort(), getKeyProperty(), isRetryOnError(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation(), getReadTimeout(), getConnectionTimeout());
=======
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), protocol, getUri(), getPort(), getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation());
>>>>>>>
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), protocol, getUri(), getPort(), getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation(), getReadTimeout(), getConnectionTimeout());
<<<<<<<
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), uri, getPort(), getKeyProperty(), isRetryOnError(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation(), getReadTimeout(), getConnectionTimeout());
=======
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), uri, getPort(), getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation());
>>>>>>>
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), uri, getPort(), getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation(), getReadTimeout(), getConnectionTimeout());
<<<<<<<
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), port, getKeyProperty(), isRetryOnError(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation(), getReadTimeout(), getConnectionTimeout());
=======
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), port, getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation());
>>>>>>>
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), port, getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation(), getReadTimeout(), getConnectionTimeout());
<<<<<<<
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), keyProperty, isRetryOnError(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation(), getReadTimeout(), getConnectionTimeout());
=======
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), keyProperty, isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation());
>>>>>>>
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), keyProperty, isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation(), getReadTimeout(), getConnectionTimeout());
<<<<<<<
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), retryOnError, getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation(), getReadTimeout(), getConnectionTimeout());
=======
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), retryOnError, getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation());
}
public ElasticSearchConfiguration withMaxConsecutiveErrors(int maxConsecutiveErrors) {
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), maxConsecutiveErrors, getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation());
>>>>>>>
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), retryOnError, getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation(), getReadTimeout(), getConnectionTimeout());
<<<<<<<
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), queueCapacity, getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation(), getReadTimeout(), getConnectionTimeout());
=======
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), queueCapacity, getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation());
>>>>>>>
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), queueCapacity, getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation(), getReadTimeout(), getConnectionTimeout());
<<<<<<<
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getQueueCapacity(), reindexBatchSize, isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation(), getReadTimeout(), getConnectionTimeout());
=======
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), reindexBatchSize, isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation());
>>>>>>>
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), reindexBatchSize, isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation(), getReadTimeout(), getConnectionTimeout());
<<<<<<<
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getQueueCapacity(), getReindexBatchSize(), executeBulk, getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation(), getReadTimeout(), getConnectionTimeout());
=======
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), executeBulk, getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation());
>>>>>>>
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), executeBulk, getAuthUser(), getAuthPassword(), getMapping(), isAsyncIndexation(), getReadTimeout(), getConnectionTimeout());
<<<<<<<
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), authUser, authPassword, getMapping(), isAsyncIndexation(), getReadTimeout(), getConnectionTimeout());
}
public ElasticSearchConfiguration withReadTimeout(int readTimeout) {
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), authUser, authPassword, getMapping(), isAsyncIndexation(), readTimeout, getConnectionTimeout());
}
public ElasticSearchConfiguration withConnectionTimeout(int connectionTimeout) {
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), authUser, authPassword, getMapping(), isAsyncIndexation(), getReadTimeout(), connectionTimeout);
=======
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), authUser, authPassword, getMapping(), isAsyncIndexation());
>>>>>>>
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), authUser, authPassword, getMapping(), isAsyncIndexation(), getReadTimeout(), getConnectionTimeout());
}
public ElasticSearchConfiguration withReadTimeout(int readTimeout) {
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), authUser, authPassword, getMapping(), isAsyncIndexation(), readTimeout, getConnectionTimeout());
}
public ElasticSearchConfiguration withConnectionTimeout(int connectionTimeout) {
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), authUser, authPassword, getMapping(), isAsyncIndexation(), getReadTimeout(), connectionTimeout);
<<<<<<<
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), mapping, isAsyncIndexation(), DEFAULT_READ_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT);
=======
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), mapping, isAsyncIndexation());
>>>>>>>
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), mapping, isAsyncIndexation(), DEFAULT_READ_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT);
<<<<<<<
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), asyncIndexation, DEFAULT_READ_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT);
=======
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), asyncIndexation);
>>>>>>>
return new ElasticSearchConfiguration(getInclusionPolicies(), initializeUntil(), getProtocol(), getUri(), getPort(), getKeyProperty(), isRetryOnError(), getMaxConsecutiveErrors(), getQueueCapacity(), getReindexBatchSize(), isExecuteBulk(), getAuthUser(), getAuthPassword(), getMapping(), asyncIndexation, DEFAULT_READ_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT); |
<<<<<<<
updateState(new LocalDateTime());
=======
updateState(System.currentTimeMillis());
>>>>>>>
updateState(new LocalDateTime());
<<<<<<<
public boolean updateState(LocalDateTime now) {
=======
public boolean updateState(Long now) {
>>>>>>>
public boolean updateState(LocalDateTime now) {
<<<<<<<
onStateChanged(now, previousState, currentState);
=======
stateLastChangedTimestamp = now;
onStateChanged(previousState, currentState);
>>>>>>>
stateLastChangedTimestamp = now;
onStateChanged(now, previousState, currentState);
<<<<<<<
/**
* Returns true, if inState occurs after last occurance of afterLastState in state history.
* @param inState
* @param afterLastState
* @return
*/
public boolean wasInStateAfterLastState(State inState, State afterLastState) {
int indexLastAfterState = stateHistory.lastIndexOf(afterLastState);
if(indexLastAfterState > -1) {
List<State> afterStates = stateHistory.subList(indexLastAfterState, stateHistory.size() - 1);
return afterStates.contains(afterLastState);
}
return false;
}
=======
public Long getStateLastChangedTimestamp() {
return stateLastChangedTimestamp;
}
>>>>>>>
/**
* Returns true, if inState occurs after last occurance of afterLastState in state history.
* @param inState
* @param afterLastState
* @return
*/
public boolean wasInStateAfterLastState(State inState, State afterLastState) {
int indexLastAfterState = stateHistory.lastIndexOf(afterLastState);
if(indexLastAfterState > -1) {
List<State> afterStates = stateHistory.subList(indexLastAfterState, stateHistory.size() - 1);
return afterStates.contains(afterLastState);
}
return false;
}
public Long getStateLastChangedTimestamp() {
return stateLastChangedTimestamp;
} |
<<<<<<<
import java.util.HashMap;
=======
import java.util.Iterator;
>>>>>>>
import java.util.HashMap;
import java.util.Iterator;
<<<<<<<
public class FancyMessage implements ConfigurationSerializable {
static{
ConfigurationSerialization.registerClass(FancyMessage.class);
}
private List<MessagePart> messageParts;
=======
public class FancyMessage implements JsonRepresentedObject, Cloneable, Iterable<MessagePart> {
private List<MessagePart> messageParts;
>>>>>>>
public class FancyMessage implements JsonRepresentedObject, Cloneable, Iterable<MessagePart>, ConfigurationSerializable {
static{
ConfigurationSerialization.registerClass(FancyMessage.class);
}
private List<MessagePart> messageParts;
<<<<<<<
// Doc copied from interface
public Map<String, Object> serialize() {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("messageParts", messageParts);
map.put("JSON", toJSONString());
return map;
}
@SuppressWarnings("unchecked")
public static FancyMessage deserialize(Map<String, Object> serialized){
FancyMessage msg = new FancyMessage();
msg.messageParts = (List<MessagePart>)serialized.get("messageParts");
msg.jsonString = serialized.get("JSON").toString();
msg.dirty = false;
return msg;
}
=======
/**
* <b>Internally called method. Not for API consumption.</b>
*/
public Iterator<MessagePart> iterator() {
return messageParts.iterator();
}
>>>>>>>
// Doc copied from interface
public Map<String, Object> serialize() {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("messageParts", messageParts);
map.put("JSON", toJSONString());
return map;
}
@SuppressWarnings("unchecked")
public static FancyMessage deserialize(Map<String, Object> serialized){
FancyMessage msg = new FancyMessage();
msg.messageParts = (List<MessagePart>)serialized.get("messageParts");
msg.jsonString = serialized.get("JSON").toString();
msg.dirty = false;
return msg;
}
/**
* <b>Internally called method. Not for API consumption.</b>
*/
public Iterator<MessagePart> iterator() {
return messageParts.iterator();
} |
<<<<<<<
BigInteger minGasLimit = BigInteger.valueOf(constants.getMIN_GAS_LIMIT());
BigInteger targetGasLimit = BigInteger.valueOf(constants.getTARGET_GAS_LIMIT());
BigInteger newGasLimit = calc.calculateBlockGasLimit(minGasLimit, BigInteger.ZERO, minGasLimit, targetGasLimit, false);
=======
BigInteger minGasLimit = BigInteger.valueOf(constants.getMinGasLimit());
BigInteger targetGasLimit = BigInteger.valueOf(constants.getTargetGasLimit());
BigInteger newGasLimit = calc.calculateBlockGasLimit(minGasLimit, BigInteger.ZERO, minGasLimit, targetGasLimit);
>>>>>>>
BigInteger minGasLimit = BigInteger.valueOf(constants.getMinGasLimit());
BigInteger targetGasLimit = BigInteger.valueOf(constants.getTargetGasLimit());
BigInteger newGasLimit = calc.calculateBlockGasLimit(minGasLimit, BigInteger.ZERO, minGasLimit, targetGasLimit, false);
<<<<<<<
BigInteger parentGas = BigInteger.valueOf(3500000);
BigInteger gasUsed = BigInteger.valueOf(3000000);
BigInteger targetGasLimit = BigInteger.valueOf(constants.getTARGET_GAS_LIMIT());
=======
BigInteger gasUsed = BigInteger.valueOf(10000);
BigInteger targetGasLimit = BigInteger.valueOf(constants.getTargetGasLimit());
>>>>>>>
BigInteger parentGas = BigInteger.valueOf(3500000);
BigInteger gasUsed = BigInteger.valueOf(3000000);
BigInteger targetGasLimit = BigInteger.valueOf(constants.getTargetGasLimit()); |
<<<<<<<
import org.ethereum.facade.Ethereum;
import org.ethereum.manager.WorldManager;
import org.ethereum.net.server.ChannelManager;
=======
>>>>>>>
<<<<<<<
Web3Impl web3 = new Web3Impl(getMockEthereum(), getMockProperties(), WalletFactory.createWallet(), minerClient, minerServer, Mockito.mock(ChannelManager.class));
=======
PersonalModule pm = new PersonalModuleWalletDisabled();
Web3Impl web3 = new Web3Impl(Web3Mocks.getMockEthereum(), Web3Mocks.getMockProperties(), minerClient, minerServer, pm, null);
>>>>>>>
PersonalModule pm = new PersonalModuleWalletDisabled();
Web3Impl web3 = new Web3Impl(Web3Mocks.getMockEthereum(), Web3Mocks.getMockProperties(), minerClient, minerServer, pm, null, Web3Mocks.getMockChannelManager()); |
<<<<<<<
import co.rsk.net.utils.TransactionUtils;
=======
import co.rsk.scoring.EventType;
import co.rsk.scoring.PeerScoring;
import co.rsk.scoring.PeerScoringManager;
import co.rsk.scoring.PunishmentParameters;
>>>>>>>
import co.rsk.net.utils.TransactionUtils;
import co.rsk.scoring.EventType;
import co.rsk.scoring.PeerScoring;
import co.rsk.scoring.PeerScoringManager;
import co.rsk.scoring.PunishmentParameters;
<<<<<<<
import java.math.BigInteger;
=======
import java.net.UnknownHostException;
>>>>>>>
import java.math.BigInteger;
import java.net.UnknownHostException;
<<<<<<<
processor.processMessage(new SimpleMessageChannel(), message);
=======
processor.processMessage(sender, message);
>>>>>>>
processor.processMessage(sender, message);
<<<<<<<
processor.processMessage(new SimpleMessageChannel(), message);
=======
processor.processMessage(sender, message);
>>>>>>>
processor.processMessage(sender, message);
<<<<<<<
final BlockStore store = new BlockStore();
BlockNodeInformation nodeInformation = new BlockNodeInformation();
BlockSyncService blockSyncService = new BlockSyncService(store, blockchain, nodeInformation, null);
final NodeBlockProcessor bp = new NodeBlockProcessor(store, blockchain, nodeInformation, blockSyncService);
final SimpleMessageChannel sender = new SimpleMessageChannel();
final NodeMessageHandler handler = new NodeMessageHandler(bp, null, null, null, null);
=======
final NodeBlockProcessor bp = new NodeBlockProcessor(store, blockchain);
final SimpleMessageSender sender = new SimpleMessageSender();
final NodeMessageHandler handler = new NodeMessageHandler(bp, null, null, null, null);
>>>>>>>
final BlockStore store = new BlockStore();
BlockNodeInformation nodeInformation = new BlockNodeInformation();
BlockSyncService blockSyncService = new BlockSyncService(store, blockchain, nodeInformation, null);
final NodeBlockProcessor bp = new NodeBlockProcessor(store, blockchain, nodeInformation, blockSyncService);
final SimpleMessageChannel sender = new SimpleMessageChannel();
final NodeMessageHandler handler = new NodeMessageHandler(bp, null, null, null, null, null);
<<<<<<<
BlockNodeInformation nodeInformation = new BlockNodeInformation();
BlockSyncService blockSyncService = new BlockSyncService(store, blockchain, nodeInformation, null);
final NodeBlockProcessor bp = new NodeBlockProcessor(store, blockchain, nodeInformation, blockSyncService);
final NodeMessageHandler handler = new NodeMessageHandler(bp, null, null, null, null);
=======
final NodeBlockProcessor bp = new NodeBlockProcessor(store, blockchain);
final NodeMessageHandler handler = new NodeMessageHandler(bp, null, null, null, null);
>>>>>>>
BlockNodeInformation nodeInformation = new BlockNodeInformation();
BlockSyncService blockSyncService = new BlockSyncService(store, blockchain, nodeInformation, null);
final NodeBlockProcessor bp = new NodeBlockProcessor(store, blockchain, nodeInformation, blockSyncService);
final NodeMessageHandler handler = new NodeMessageHandler(bp, null, null, null, null, null);
<<<<<<<
final NodeMessageHandler handler = new NodeMessageHandler(blockProcessor, null, null, null, txHandler);
=======
final NodeMessageHandler handler = new NodeMessageHandler(blockProcessor, null, null, txHandler, null);
>>>>>>>
final NodeMessageHandler handler = new NodeMessageHandler(blockProcessor, null, null, null, txHandler, null);
<<<<<<<
BlockNodeInformation nodeInformation = new BlockNodeInformation();
BlockSyncService blockSyncService = new BlockSyncService(store, blockchain, nodeInformation, null);
final NodeBlockProcessor bp = new NodeBlockProcessor(store, blockchain, nodeInformation, blockSyncService);
final NodeMessageHandler handler = new NodeMessageHandler(bp, null, null, null, null);
=======
final NodeBlockProcessor bp = new NodeBlockProcessor(store, blockchain);
final NodeMessageHandler handler = new NodeMessageHandler(bp, null, null, null, null);
>>>>>>>
BlockNodeInformation nodeInformation = new BlockNodeInformation();
BlockSyncService blockSyncService = new BlockSyncService(store, blockchain, nodeInformation, null);
final NodeBlockProcessor bp = new NodeBlockProcessor(store, blockchain, nodeInformation, blockSyncService);
final NodeMessageHandler handler = new NodeMessageHandler(bp, null, null, null, null, null);
<<<<<<<
Assert.assertTrue(channelManager.getLastSkip().contains(sender.getPeerNodeID()));
Assert.assertTrue(channelManager.getLastSkip().contains(sender2.getPeerNodeID()));
=======
Assert.assertTrue(channelManager.getLastSkip().contains(sender.getNodeID()));
Assert.assertTrue(channelManager.getLastSkip().contains(sender2.getNodeID()));
Assert.assertFalse(scoring.isEmpty());
PeerScoring pscoring = scoring.getPeerScoring(sender.getNodeID());
Assert.assertNotNull(pscoring);
Assert.assertFalse(pscoring.isEmpty());
Assert.assertEquals(10, pscoring.getTotalEventCounter());
Assert.assertEquals(10, pscoring.getEventCounter(EventType.VALID_TRANSACTION));
pscoring = scoring.getPeerScoring(sender2.getNodeID());
Assert.assertNotNull(pscoring);
Assert.assertFalse(pscoring.isEmpty());
Assert.assertEquals(10, pscoring.getTotalEventCounter());
Assert.assertEquals(10, pscoring.getEventCounter(EventType.VALID_TRANSACTION));
}
@Test
public void processRejectedTransactionsMessage() throws UnknownHostException {
PeerScoringManager scoring = createPeerScoringManager();
final SimpleChannelManager channelManager = new SimpleChannelManager();
TxHandler txmock = Mockito.mock(TxHandler.class);
BlockProcessor blockProcessor = Mockito.mock(BlockProcessor.class);
Mockito.when(blockProcessor.hasBetterBlockToSync()).thenReturn(false);
final NodeMessageHandler handler = new NodeMessageHandler(blockProcessor, channelManager, null, txmock, scoring);
final SimpleMessageSender sender = new SimpleMessageSender();
final List<Transaction> txs = TransactionUtils.getTransactions(0);
Mockito.when(txmock.retrieveValidTxs(any(List.class))).thenReturn(txs);
final TransactionsMessage message = new TransactionsMessage(txs);
handler.processMessage(sender, message);
Assert.assertNotNull(channelManager.getTransactions());
Assert.assertEquals(0, channelManager.getTransactions().size());
Assert.assertTrue(scoring.isEmpty());
PeerScoring pscoring = scoring.getPeerScoring(sender.getNodeID());
Assert.assertNotNull(pscoring);
Assert.assertTrue(pscoring.isEmpty());
Assert.assertEquals(0, pscoring.getTotalEventCounter());
Assert.assertEquals(0, pscoring.getEventCounter(EventType.INVALID_TRANSACTION));
>>>>>>>
Assert.assertTrue(channelManager.getLastSkip().contains(sender.getPeerNodeID()));
Assert.assertTrue(channelManager.getLastSkip().contains(sender2.getPeerNodeID()));
Assert.assertFalse(scoring.isEmpty());
PeerScoring pscoring = scoring.getPeerScoring(sender.getPeerNodeID());
Assert.assertNotNull(pscoring);
Assert.assertFalse(pscoring.isEmpty());
Assert.assertEquals(10, pscoring.getTotalEventCounter());
Assert.assertEquals(10, pscoring.getEventCounter(EventType.VALID_TRANSACTION));
pscoring = scoring.getPeerScoring(sender2.getPeerNodeID());
Assert.assertNotNull(pscoring);
Assert.assertFalse(pscoring.isEmpty());
Assert.assertEquals(10, pscoring.getTotalEventCounter());
Assert.assertEquals(10, pscoring.getEventCounter(EventType.VALID_TRANSACTION));
}
@Test
public void processRejectedTransactionsMessage() throws UnknownHostException {
PeerScoringManager scoring = createPeerScoringManager();
final SimpleChannelManager channelManager = new SimpleChannelManager();
TxHandler txmock = Mockito.mock(TxHandler.class);
BlockProcessor blockProcessor = Mockito.mock(BlockProcessor.class);
Mockito.when(blockProcessor.hasBetterBlockToSync()).thenReturn(false);
final NodeMessageHandler handler = new NodeMessageHandler(blockProcessor, null, channelManager, null, txmock, scoring);
final SimpleMessageChannel sender = new SimpleMessageChannel();
final List<Transaction> txs = TransactionUtils.getTransactions(0);
Mockito.when(txmock.retrieveValidTxs(any(List.class))).thenReturn(txs);
final TransactionsMessage message = new TransactionsMessage(txs);
handler.processMessage(sender, message);
Assert.assertNotNull(channelManager.getTransactions());
Assert.assertEquals(0, channelManager.getTransactions().size());
Assert.assertTrue(scoring.isEmpty());
PeerScoring pscoring = scoring.getPeerScoring(sender.getPeerNodeID());
Assert.assertNotNull(pscoring);
Assert.assertTrue(pscoring.isEmpty());
Assert.assertEquals(0, pscoring.getTotalEventCounter());
Assert.assertEquals(0, pscoring.getEventCounter(EventType.INVALID_TRANSACTION));
<<<<<<<
final NodeMessageHandler handler = new NodeMessageHandler(blockProcessor, null, channelManager, null, txHandler);
=======
final NodeMessageHandler handler = new NodeMessageHandler(blockProcessor, channelManager, null, txHandler, null);
>>>>>>>
final NodeMessageHandler handler = new NodeMessageHandler(blockProcessor, null, channelManager, null, txHandler, null);
<<<<<<<
final NodeMessageHandler handler = new NodeMessageHandler(blockProcessor, null, channelManager, pendingState, txmock);
=======
final NodeMessageHandler handler = new NodeMessageHandler(blockProcessor, channelManager, pendingState, txmock, null);
>>>>>>>
final NodeMessageHandler handler = new NodeMessageHandler(blockProcessor, null, channelManager, pendingState, txmock, null);
<<<<<<<
@Test
public void processBlockByHashRequestMessageUsingProcessor() {
SimpleBlockProcessor sbp = new SimpleBlockProcessor();
NodeMessageHandler processor = new NodeMessageHandler(sbp, null, null, null, null);
Block block = new Block(Hex.decode(rlp));
Message message = new BlockRequestMessage(100, block.getHash());
processor.processMessage(new SimpleMessageChannel(), message);
Assert.assertEquals(100, sbp.getRequestId());
Assert.assertArrayEquals(block.getHash(), sbp.getHash());
}
@Test
public void processBlockHeadersRequestMessageUsingProcessor() {
byte[] hash = HashUtil.randomHash();
SimpleBlockProcessor sbp = new SimpleBlockProcessor();
NodeMessageHandler processor = new NodeMessageHandler(sbp, null, null, null, null);
Message message = new BlockHeadersRequestMessage(100, hash, 50);
processor.processMessage(new SimpleMessageChannel(), message);
Assert.assertEquals(100, sbp.getRequestId());
Assert.assertArrayEquals(hash, sbp.getHash());
}
=======
private static PeerScoringManager createPeerScoringManager() {
return new PeerScoringManager(1000, new PunishmentParameters(600000, 10, 10000000), new PunishmentParameters(600000, 10, 10000000));
}
>>>>>>>
@Test
public void processBlockByHashRequestMessageUsingProcessor() throws UnknownHostException {
SimpleBlockProcessor sbp = new SimpleBlockProcessor();
NodeMessageHandler processor = new NodeMessageHandler(sbp, null, null, null, null, null);
Block block = new Block(Hex.decode(rlp));
Message message = new BlockRequestMessage(100, block.getHash());
processor.processMessage(new SimpleMessageChannel(), message);
Assert.assertEquals(100, sbp.getRequestId());
Assert.assertArrayEquals(block.getHash(), sbp.getHash());
}
@Test
public void processBlockHeadersRequestMessageUsingProcessor() throws UnknownHostException {
byte[] hash = HashUtil.randomHash();
SimpleBlockProcessor sbp = new SimpleBlockProcessor();
NodeMessageHandler processor = new NodeMessageHandler(sbp, null, null, null, null, null);
Message message = new BlockHeadersRequestMessage(100, hash, 50);
processor.processMessage(new SimpleMessageChannel(), message);
Assert.assertEquals(100, sbp.getRequestId());
Assert.assertArrayEquals(hash, sbp.getHash());
}
private static PeerScoringManager createPeerScoringManager() {
return new PeerScoringManager(1000, new PunishmentParameters(600000, 10, 10000000), new PunishmentParameters(600000, 10, 10000000));
} |
<<<<<<<
private ChannelManager channelManager;
=======
private RskSystemProperties rskSystemProperties;
>>>>>>>
private RskSystemProperties rskSystemProperties;
private ChannelManager channelManager;
<<<<<<<
public Start(Rsk rsk, UDPServer udpServer, MinerServer minerServer, MinerClient minerClient, ChannelManager channelManager) {
=======
public Start(Rsk rsk, UDPServer udpServer, MinerServer minerServer, MinerClient minerClient, RskSystemProperties rskSystemProperties) {
>>>>>>>
public Start(Rsk rsk, UDPServer udpServer, MinerServer minerServer, MinerClient minerClient, RskSystemProperties rskSystemProperties, ChannelManager channelManager) {
<<<<<<<
this.channelManager = channelManager;
=======
this.rskSystemProperties = rskSystemProperties;
>>>>>>>
this.rskSystemProperties = rskSystemProperties;
this.channelManager = channelManager;
<<<<<<<
private void enableRpc(Rsk rsk) throws Exception {
Web3 web3Service = new Web3RskImpl(rsk, minerServer, minerClient, channelManager);
JsonRpcWeb3ServerHandler serverHandler = new JsonRpcWeb3ServerHandler(web3Service, RskSystemProperties.CONFIG.getRpcModules());
=======
private void enableRpc(Rsk rsk) throws InterruptedException {
Web3 web3Service = new Web3RskImpl(rsk, minerServer, minerClient);
JsonRpcWeb3ServerHandler serverHandler = new JsonRpcWeb3ServerHandler(web3Service, rskSystemProperties.getRpcModules());
>>>>>>>
private void enableRpc(Rsk rsk) throws InterruptedException {
Web3 web3Service = new Web3RskImpl(rsk, minerServer, minerClient, channelManager);
JsonRpcWeb3ServerHandler serverHandler = new JsonRpcWeb3ServerHandler(web3Service, rskSystemProperties.getRpcModules()); |
<<<<<<<
import java.math.BigInteger;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
=======
import java.util.*;
>>>>>>>
import java.math.BigInteger;
import java.util.*;
<<<<<<<
List<Transaction> txs = message.getTransactions();
Metrics.processTxsMessage("start", txs, sender.getPeerNodeID());
=======
List<Transaction> ptxs = message.getTransactions();
Metrics.processTxsMessage("start", ptxs, sender.getNodeID());
List<Transaction> txs = new LinkedList();
for (Transaction tx : ptxs) {
if (tx.getSignature() == null || !tx.acceptTransactionSignature()) {
recordEvent(sender, EventType.INVALID_TRANSACTION);
} else {
txs.add(tx);
recordEvent(sender, EventType.VALID_TRANSACTION);
}
}
>>>>>>>
List<Transaction> ptxs = message.getTransactions();
Metrics.processTxsMessage("start", ptxs, sender.getPeerNodeID());
List<Transaction> txs = new LinkedList();
for (Transaction tx : ptxs) {
if (tx.getSignature() == null || !tx.acceptTransactionSignature()) {
recordEvent(sender, EventType.INVALID_TRANSACTION);
} else {
txs.add(tx);
recordEvent(sender, EventType.VALID_TRANSACTION);
}
}
<<<<<<<
Metrics.processTxsMessage("txToNodeInfoUpdated", acceptedTxs, sender.getPeerNodeID());
Metrics.processTxsMessage("finish", acceptedTxs, sender.getPeerNodeID());
=======
Metrics.processTxsMessage("txToNodeInfoUpdated", acceptedTxs, sender.getNodeID());
Metrics.processTxsMessage("finish", acceptedTxs, sender.getNodeID());
>>>>>>>
Metrics.processTxsMessage("txToNodeInfoUpdated", acceptedTxs, sender.getPeerNodeID());
Metrics.processTxsMessage("finish", acceptedTxs, sender.getPeerNodeID()); |
<<<<<<<
import co.rsk.net.sync.SyncConfiguration;
=======
import co.rsk.rpc.Web3RskImpl;
import co.rsk.rpc.modules.eth.*;
import co.rsk.rpc.modules.personal.PersonalModule;
import co.rsk.rpc.modules.personal.PersonalModuleWalletDisabled;
import co.rsk.rpc.modules.personal.PersonalModuleWalletEnabled;
>>>>>>>
import co.rsk.net.sync.SyncConfiguration;
import co.rsk.rpc.Web3RskImpl;
import co.rsk.rpc.modules.eth.*;
import co.rsk.rpc.modules.personal.PersonalModule;
import co.rsk.rpc.modules.personal.PersonalModuleWalletDisabled;
import co.rsk.rpc.modules.personal.PersonalModuleWalletEnabled;
<<<<<<<
import co.rsk.validators.ProofOfWorkRule;
=======
import co.rsk.validators.BlockValidator;
>>>>>>>
import co.rsk.validators.BlockValidator;
import co.rsk.validators.ProofOfWorkRule;
<<<<<<<
import org.ethereum.sync.SyncPool;
=======
import org.ethereum.solidity.compiler.SolidityCompiler;
>>>>>>>
import org.ethereum.solidity.compiler.SolidityCompiler;
import org.ethereum.sync.SyncPool;
<<<<<<<
public SyncPool.PeerClientFactory getPeerClientFactory(SystemProperties config,
EthereumListener ethereumListener,
EthereumChannelInitializerFactory ethereumChannelInitializerFactory) {
=======
public Start.Web3Factory getWeb3Factory(Rsk rsk,
RskSystemProperties config,
MinerClient minerClient,
MinerServer minerServer,
PersonalModule personalModule,
EthModule ethModule) {
return () -> new Web3RskImpl(rsk, config, minerClient, minerServer, personalModule, ethModule);
}
@Bean
public BlockChainImpl getBlockchain(org.ethereum.core.Repository repository,
org.ethereum.db.BlockStore blockStore,
ReceiptStore receiptStore,
EthereumListener listener,
AdminInfo adminInfo,
BlockValidator blockValidator) {
return new BlockChainImpl(
repository,
blockStore,
receiptStore,
null, // circular dependency
listener,
adminInfo,
blockValidator
);
}
@Bean
public PendingState getPendingState(BlockChainImpl blockchain,
org.ethereum.db.BlockStore blockStore,
org.ethereum.core.Repository repository) {
PendingStateImpl pendingState = new PendingStateImpl(
blockchain,
blockStore,
repository
);
// circular dependency
blockchain.setPendingState(pendingState);
return pendingState;
}
@Bean
public EthereumImpl.PeerClientFactory getPeerClientFactory(SystemProperties config,
EthereumListener ethereumListener,
EthereumChannelInitializerFactory ethereumChannelInitializerFactory) {
>>>>>>>
public Start.Web3Factory getWeb3Factory(Rsk rsk,
RskSystemProperties config,
MinerClient minerClient,
MinerServer minerServer,
PersonalModule personalModule,
EthModule ethModule,
ChannelManager channelManager) {
return () -> new Web3RskImpl(rsk, config, minerClient, minerServer, personalModule, ethModule, channelManager);
}
@Bean
public BlockChainImpl getBlockchain(org.ethereum.core.Repository repository,
org.ethereum.db.BlockStore blockStore,
ReceiptStore receiptStore,
EthereumListener listener,
AdminInfo adminInfo,
BlockValidator blockValidator) {
return new BlockChainImpl(
repository,
blockStore,
receiptStore,
null, // circular dependency
listener,
adminInfo,
blockValidator
);
}
@Bean
public PendingState getPendingState(BlockChainImpl blockchain,
org.ethereum.db.BlockStore blockStore,
org.ethereum.core.Repository repository) {
PendingStateImpl pendingState = new PendingStateImpl(
blockchain,
blockStore,
repository
);
// circular dependency
blockchain.setPendingState(pendingState);
return pendingState;
}
@Bean
public SyncPool.PeerClientFactory getPeerClientFactory(SystemProperties config,
EthereumListener ethereumListener,
EthereumChannelInitializerFactory ethereumChannelInitializerFactory) {
<<<<<<<
@Bean
public SyncConfiguration getSyncConfiguration() {
int expectedPeers = RskSystemProperties.CONFIG.getExpectedPeers();
int timeoutWaitingPeers = RskSystemProperties.CONFIG.getTimeoutWaitingPeers();
int timeoutWaitingRequest = RskSystemProperties.CONFIG.getTimeoutWaitingRequest();
int expirationTimePeerStatus = RskSystemProperties.CONFIG.getExpirationTimePeerStatus();
int maxSkeletonChunks = RskSystemProperties.CONFIG.getMaxSkeletonChunks();
int chunkSize = RskSystemProperties.CONFIG.getChunkSize();
return new SyncConfiguration(expectedPeers, timeoutWaitingPeers, timeoutWaitingRequest,
expirationTimePeerStatus, maxSkeletonChunks, chunkSize);
}
@Bean
public BlockStore getBlockStore(){
return new BlockStore();
}
=======
@Bean
public Wallet getWallet(RskSystemProperties config) {
if (!config.isWalletEnabled()) {
logger.info("Local wallet disabled");
return null;
}
logger.info("Local wallet enabled");
KeyValueDataSource ds = new LevelDbDataSource("wallet");
ds.init();
return new Wallet(ds);
}
@Bean
public PersonalModule getPersonalModuleWallet(Rsk rsk, Wallet wallet) {
if (wallet == null) {
return new PersonalModuleWalletDisabled();
}
return new PersonalModuleWalletEnabled(rsk, wallet);
}
@Bean
public EthModuleWallet getEthModuleWallet(Rsk rsk, Wallet wallet) {
if (wallet == null) {
return new EthModuleWalletDisabled();
}
return new EthModuleWalletEnabled(rsk, wallet);
}
@Bean
public EthModuleSolidity getEthModuleSolidity(RskSystemProperties config) {
try {
return new EthModuleSolidityEnabled(new SolidityCompiler(config));
} catch (RuntimeException e) {
// the only way we currently have to check if Solidity is available is catching this exception
logger.debug("Solidity compiler unavailable", e);
return new EthModuleSolidityDisabled();
}
}
>>>>>>>
@Bean
public Wallet getWallet(RskSystemProperties config) {
if (!config.isWalletEnabled()) {
logger.info("Local wallet disabled");
return null;
}
logger.info("Local wallet enabled");
KeyValueDataSource ds = new LevelDbDataSource("wallet");
ds.init();
return new Wallet(ds);
}
@Bean
public PersonalModule getPersonalModuleWallet(Rsk rsk, Wallet wallet) {
if (wallet == null) {
return new PersonalModuleWalletDisabled();
}
return new PersonalModuleWalletEnabled(rsk, wallet);
}
@Bean
public EthModuleWallet getEthModuleWallet(Rsk rsk, Wallet wallet) {
if (wallet == null) {
return new EthModuleWalletDisabled();
}
return new EthModuleWalletEnabled(rsk, wallet);
}
@Bean
public EthModuleSolidity getEthModuleSolidity(RskSystemProperties config) {
try {
return new EthModuleSolidityEnabled(new SolidityCompiler(config));
} catch (RuntimeException e) {
// the only way we currently have to check if Solidity is available is catching this exception
logger.debug("Solidity compiler unavailable", e);
return new EthModuleSolidityDisabled();
}
}
@Bean
public SyncConfiguration getSyncConfiguration() {
int expectedPeers = RskSystemProperties.CONFIG.getExpectedPeers();
int timeoutWaitingPeers = RskSystemProperties.CONFIG.getTimeoutWaitingPeers();
int timeoutWaitingRequest = RskSystemProperties.CONFIG.getTimeoutWaitingRequest();
int expirationTimePeerStatus = RskSystemProperties.CONFIG.getExpirationTimePeerStatus();
int maxSkeletonChunks = RskSystemProperties.CONFIG.getMaxSkeletonChunks();
int chunkSize = RskSystemProperties.CONFIG.getChunkSize();
return new SyncConfiguration(expectedPeers, timeoutWaitingPeers, timeoutWaitingRequest,
expirationTimePeerStatus, maxSkeletonChunks, chunkSize);
}
@Bean
public BlockStore getBlockStore(){
return new BlockStore();
} |
<<<<<<<
import co.rsk.core.bc.BlockChainStatus;
import co.rsk.net.MessageHandler;
import co.rsk.net.MessageChannel;
import co.rsk.net.Metrics;
import co.rsk.net.Status;
=======
import co.rsk.net.*;
>>>>>>>
import co.rsk.core.bc.BlockChainStatus;
import co.rsk.net.MessageHandler;
import co.rsk.net.MessageChannel;
import co.rsk.net.Metrics;
import co.rsk.net.Status;
import co.rsk.net.*;
<<<<<<<
this.messageChannel.setPeerNodeID(channel.getNodeId());
=======
this.messageSender.setNodeID(channel.getNodeId());
this.messageSender.setAddress(channel.getInetSocketAddress().getAddress());
>>>>>>>
this.messageChannel.setPeerNodeID(channel.getNodeId());
this.messageChannel.setAddress(channel.getInetSocketAddress().getAddress());
<<<<<<<
Metrics.messageBytes(messageChannel.getPeerNodeID(), msg.getEncoded().length);
=======
if (!hasGoodReputation(ctx)) {
ctx.disconnect();
return;
}
Metrics.messageBytes(messageSender.getNodeID(), msg.getEncoded().length);
>>>>>>>
if (!hasGoodReputation(ctx)) {
ctx.disconnect();
return;
}
Metrics.messageBytes(messageChannel.getPeerNodeID(), msg.getEncoded().length); |
<<<<<<<
Block genesis = BlockGenerator.getGenesisBlock();
Blockchain blockchain = BlockChainBuilder.ofSize(0);
=======
Blockchain blockchain = createBlockchain();
>>>>>>>
Blockchain blockchain = BlockChainBuilder.ofSize(0);
<<<<<<<
final Blockchain blockchain = BlockChainBuilder.ofSize(0);
BlockNodeInformation nodeInformation = new BlockNodeInformation();
BlockSyncService blockSyncService = new BlockSyncService(store, blockchain, nodeInformation, null);
final NodeBlockProcessor processor = new NodeBlockProcessor(store, blockchain, nodeInformation, blockSyncService);
=======
final Blockchain blockchain = createBlockchain(0);
final NodeBlockProcessor processor = new NodeBlockProcessor(store, blockchain);
>>>>>>>
final Blockchain blockchain = BlockChainBuilder.ofSize(0);
BlockNodeInformation nodeInformation = new BlockNodeInformation();
BlockSyncService blockSyncService = new BlockSyncService(store, blockchain, nodeInformation, null);
final NodeBlockProcessor processor = new NodeBlockProcessor(store, blockchain, nodeInformation, blockSyncService);
<<<<<<<
public void processGetBlockHeaderMessageUsingBlockInBlockchain() {
final Blockchain blockchain = BlockChainBuilder.ofSize(10);
=======
public void processGetBlockHeaderMessageUsingBlockInBlockchain() throws UnknownHostException {
final Blockchain blockchain = createBlockchain(10);
>>>>>>>
public void processGetBlockHeaderMessageUsingBlockInBlockchain() throws UnknownHostException {
final Blockchain blockchain = BlockChainBuilder.ofSize(10);
<<<<<<<
BlockNodeInformation nodeInformation = new BlockNodeInformation();
BlockSyncService blockSyncService = new BlockSyncService(store, blockchain, nodeInformation, null);
final NodeBlockProcessor processor = new NodeBlockProcessor(store, blockchain, nodeInformation, blockSyncService);
=======
final NodeBlockProcessor processor = new NodeBlockProcessor(store, blockchain);
>>>>>>>
BlockNodeInformation nodeInformation = new BlockNodeInformation();
BlockSyncService blockSyncService = new BlockSyncService(store, blockchain, nodeInformation, null);
final NodeBlockProcessor processor = new NodeBlockProcessor(store, blockchain, nodeInformation, blockSyncService);
<<<<<<<
public void processGetBlockMessageUsingBlockInBlockchain() {
final Blockchain blockchain = BlockChainBuilder.ofSize(10);
=======
public void processGetBlockMessageUsingBlockInBlockchain() throws UnknownHostException {
final Blockchain blockchain = createBlockchain(10);
>>>>>>>
public void processGetBlockMessageUsingBlockInBlockchain() throws UnknownHostException {
final Blockchain blockchain = BlockChainBuilder.ofSize(10); |
<<<<<<<
return getBlockChain(parent, size, ntxs, false, null);
=======
return getBlockChain(parent, size, ntxs, false, false);
>>>>>>>
return getBlockChain(parent, size, ntxs, false);
<<<<<<<
return getBlockChain(parent, size, ntxs, withUncles, null);
}
public static List<Block> getBlockChain(Block parent, int size, int ntxs, boolean withUncles, Long difficulty) {
=======
return getBlockChain(parent, size, ntxs, withUncles, false);
}
public static List<Block> getBlockChain(Block parent, int size, int ntxs, boolean withUncles, boolean withMining) {
>>>>>>>
return getBlockChain(parent, size, ntxs, withUncles, null);
}
public static List<Block> getBlockChain(Block parent, int size, int ntxs, boolean withUncles, Long difficulty) {
return getBlockChain(parent, size, ntxs, false, false, difficulty);
}
public static List<Block> getBlockChain(Block parent, int size, int ntxs, boolean withUncles, boolean withMining, Long difficulty) {
<<<<<<<
if (difficulty == null) {
difficulty = ByteUtil.bytesToBigInteger(parent.getDifficulty()).longValue();
}
Block newblock = BlockGenerator.createChildBlock(
parent, txs, uncles,
difficulty,
null);
=======
Block newblock = BlockGenerator.createChildBlock(parent, txs, uncles, 0, null);
if (withMining)
newblock = BlockMiner.mineBlock(newblock);
>>>>>>>
if (difficulty == null) {
difficulty = ByteUtil.bytesToBigInteger(parent.getDifficulty()).longValue();
}
Block newblock = BlockGenerator.createChildBlock(
parent, txs, uncles,
difficulty,
null);
if (withMining)
newblock = BlockMiner.mineBlock(newblock); |
<<<<<<<
// we defined it be large enough for to allow large tx and also to have space still to operate on vm
private static final BigInteger TRANSACTION_GAS_CAP = BigDecimal.valueOf(Math.pow(2, 60)).toBigInteger();
public static final int DURATION_LIMIT = 8;
=======
private static final int MAX_ADDRESS_BYTE_LENGTH = 20;
>>>>>>>
// we defined it be large enough for to allow large tx and also to have space still to operate on vm
private static final BigInteger TRANSACTION_GAS_CAP = BigDecimal.valueOf(Math.pow(2, 60)).toBigInteger();
public static final int DURATION_LIMIT = 8;
private static final int MAX_ADDRESS_BYTE_LENGTH = 20; |
<<<<<<<
import co.rsk.config.RskSystemProperties;
import co.rsk.mine.MinerClient;
import co.rsk.mine.MinerServer;
import co.rsk.net.*;
import co.rsk.net.handler.TxHandlerImpl;
import co.rsk.net.sync.SyncConfiguration;
import co.rsk.validators.ProofOfWorkRule;
import org.ethereum.core.Blockchain;
=======
import co.rsk.net.MessageHandler;
import co.rsk.net.NodeBlockProcessor;
import co.rsk.net.NodeMessageHandler;
>>>>>>>
import co.rsk.config.RskSystemProperties;
import co.rsk.net.MessageHandler;
import co.rsk.net.NodeBlockProcessor;
import co.rsk.net.NodeMessageHandler;
import co.rsk.net.SyncProcessor;
import co.rsk.net.sync.SyncConfiguration;
<<<<<<<
private SyncProcessor syncProcessor;
private PeerScoringManager peerScoringManager;
=======
>>>>>>>
private SyncProcessor syncProcessor;
<<<<<<<
private static final ProofOfWorkRule blockValidationRule = new ProofOfWorkRule();
private static final Object NMH_LOCK = new Object();
private static final Object PSM_LOCK = new Object();
=======
private PeerScoringManager peerScoringManager;
>>>>>>>
private PeerScoringManager peerScoringManager;
<<<<<<<
if (this.peerScoringManager == null) {
synchronized (PSM_LOCK) {
if (this.peerScoringManager == null) {
SystemProperties config = this.getSystemProperties();
int nnodes = config.scoringNumberOfNodes();
long nodePunishmentDuration = config.scoringNodesPunishmentDuration();
int nodePunishmentIncrement = config.scoringNodesPunishmentIncrement();
long nodePunhishmentMaximumDuration = config.scoringNodesPunishmentMaximumDuration();
long addressPunishmentDuration = config.scoringAddressesPunishmentDuration();
int addressPunishmentIncrement = config.scoringAddressesPunishmentIncrement();
long addressPunishmentMaximunDuration = config.scoringAddressesPunishmentMaximumDuration();
this.peerScoringManager = new PeerScoringManager(nnodes, new PunishmentParameters(nodePunishmentDuration, nodePunishmentIncrement, nodePunhishmentMaximumDuration), new PunishmentParameters(addressPunishmentDuration, addressPunishmentIncrement, addressPunishmentMaximunDuration));
}
}
}
=======
>>>>>>>
<<<<<<<
if (this.messageHandler == null) {
synchronized (NMH_LOCK) {
if (this.messageHandler == null) {
this.nodeBlockProcessor = this.getNodeBlockProcessor(); // Initialize nodeBlockProcessor if not done already.
NodeMessageHandler handler = new NodeMessageHandler(this.nodeBlockProcessor, this.syncProcessor, getChannelManager(),
getWorldManager().getPendingState(), new TxHandlerImpl(getWorldManager()), this.getPeerScoringManager(), blockValidationRule);
handler.start();
this.messageHandler = handler;
}
}
}
=======
>>>>>>>
<<<<<<<
if (nodeBlockProcessor == null) {
BlockStore store = new BlockStore();
Blockchain blockchain = this.getWorldManager().getBlockchain();
BlockNodeInformation nodeInformation = new BlockNodeInformation();
BlockSyncService blockSyncService = new BlockSyncService(store, blockchain, nodeInformation, getChannelManager());
nodeBlockProcessor = new NodeBlockProcessor(store, blockchain, getWorldManager(), nodeInformation, blockSyncService);
syncProcessor = new SyncProcessor(blockchain, blockSyncService, getSyncConfiguration(), blockValidationRule);
}
=======
>>>>>>> |
<<<<<<<
this.messageChannel = new EthMessageChannel(this);
this.messageRecorder = RskSystemProperties.RSKCONFIG.getMessageRecorder();
=======
this.messageSender = new EthMessageSender(this);
this.messageRecorder = RskSystemProperties.CONFIG.getMessageRecorder();
>>>>>>>
this.messageChannel = new EthMessageChannel(this);
this.messageRecorder = RskSystemProperties.CONFIG.getMessageRecorder(); |
<<<<<<<
return new ManualScheduler(clock, schedulerTaskRepository, clientTaskRepository, taskResolver, executorThreads,
new DirectExecutorService(), schedulerName, waiter, heartbeatInterval, enableImmediateExecution,
statsRegistry, Optional.ofNullable(pollingStrategyConfig).orElse(PollingStrategyConfig.DEFAULT_FETCH),
deleteUnresolvedAfter, startTasks);
=======
return new ManualScheduler(clock, schedulerTaskRepository, clientTaskRepository, taskResolver, executorThreads, new DirectExecutorService(), schedulerName, waiter, heartbeatInterval, enableImmediateExecution, statsRegistry, pollingLimit, deleteUnresolvedAfter, LogLevel.DEBUG, true, startTasks);
>>>>>>>
return new ManualScheduler(clock, schedulerTaskRepository, clientTaskRepository, taskResolver, executorThreads,
new DirectExecutorService(), schedulerName, waiter, heartbeatInterval, enableImmediateExecution,
statsRegistry, Optional.ofNullable(pollingStrategyConfig).orElse(PollingStrategyConfig.DEFAULT_FETCH),
deleteUnresolvedAfter, LogLevel.DEBUG, true, startTasks); |
<<<<<<<
import com.google.common.base.Strings;
=======
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.inject.Module;
>>>>>>>
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.inject.Module;
<<<<<<<
@Override
public void detachVolume(String instanceId, String volumeId, boolean force) {
Validate.notEmpty(instanceId);
LOGGER.info(String.format("Detach volumes from instance %s in region %s.", instanceId, region));
try {
DetachVolumeRequest detachVolumeRequest = new DetachVolumeRequest();
detachVolumeRequest.setForce(force);
detachVolumeRequest.setInstanceId(instanceId);
detachVolumeRequest.setVolumeId(volumeId);
ec2Client().detachVolume(detachVolumeRequest);
} catch (AmazonServiceException e) {
if (e.getErrorCode().equals("InvalidInstanceID.NotFound")) {
throw new NotFoundException("AWS instance " + instanceId + " not found", e);
}
throw e;
}
}
@Override
public List<String> listAttachedVolumes(String instanceId, boolean includeRoot) {
Validate.notEmpty(instanceId);
LOGGER.info(String.format("Listing volumes attached to instance %s in region %s.", instanceId, region));
try {
List<String> volumeIds = new ArrayList<String>();
for (Instance instance : describeInstances(instanceId)) {
String rootDeviceName = instance.getRootDeviceName();
for (InstanceBlockDeviceMapping ibdm : instance.getBlockDeviceMappings()) {
EbsInstanceBlockDevice ebs = ibdm.getEbs();
if (ebs == null) {
continue;
}
String volumeId = ebs.getVolumeId();
if (Strings.isNullOrEmpty(volumeId)) {
continue;
}
if (!includeRoot && rootDeviceName != null) {
if (rootDeviceName.equals(ibdm.getDeviceName())) {
continue;
}
}
volumeIds.add(volumeId);
}
}
return volumeIds;
} catch (AmazonServiceException e) {
if (e.getErrorCode().equals("InvalidInstanceID.NotFound")) {
throw new NotFoundException("AWS instance " + instanceId + " not found", e);
}
throw e;
}
}
/**
* Describe a set of security groups
*
* @param groupNames the names of the groups to find
* @return a list of matching groups
*/
public List<SecurityGroup> describeSecurityGroups(String... groupNames) {
AmazonEC2 ec2Client = ec2Client();
DescribeSecurityGroupsRequest request = new DescribeSecurityGroupsRequest();
if (groupNames == null || groupNames.length == 0) {
LOGGER.info(String.format("Getting all EC2 security groups in region %s.", region));
} else {
LOGGER.info(String.format("Getting EC2 security groups for %d names in region %s.", groupNames.length,
region));
request.withGroupNames(groupNames);
}
DescribeSecurityGroupsResult result;
try {
result = ec2Client.describeSecurityGroups(request);
} catch (AmazonServiceException e) {
if (e.getErrorCode().equals("InvalidGroup.NotFound")) {
LOGGER.info("Got InvalidGroup.NotFound error for security groups; returning empty list");
return Collections.emptyList();
}
throw e;
}
List<SecurityGroup> securityGroups = result.getSecurityGroups();
LOGGER.info(String.format("Got %d EC2 security groups in region %s.", securityGroups.size(), region));
return securityGroups;
}
/**
* Create an (empty) EC2 security group.
*
* @param name
* Name of group to create
* @param description
* Description of group to create
* @return ID of created group
*/
public String createSecurityGroup(String vpcId, String name, String description) {
AmazonEC2 ec2Client = ec2Client();
CreateSecurityGroupRequest request = new CreateSecurityGroupRequest();
request.setGroupName(name);
request.setDescription(description);
request.setVpcId(vpcId);
LOGGER.info(String.format("Creating EC2 security group %s.", name));
CreateSecurityGroupResult result = ec2Client.createSecurityGroup(request);
return result.getGroupId();
}
/**
* Convenience wrapper around describeInstances, for a single instance id.
*
* @param instanceId id of instance to find
* @return the instance info, or null if instance not found
*/
public Instance describeInstance(String instanceId) {
Instance instance = null;
for (Instance i : describeInstances(instanceId)) {
if (instance != null) {
throw new IllegalStateException("Duplicate instance: " + instanceId);
}
instance = i;
}
return instance;
}
=======
@Override
public NodeMetadata findJcloudsNode(String instanceId) {
List<String> instanceIds = Lists.newArrayList();
instanceIds.add(instanceId);
Set<? extends NodeMetadata> nodes = jcloudsComputeService.listNodesByIds(instanceIds);
if (nodes.isEmpty()) {
return null;
}
return Iterables.getOnlyElement(nodes);
}
@Override
public SshClient getJcloudsSsh(NodeMetadata node) {
Utils utils = jcloudsComputeService.getContext().getUtils();
SshClient ssh = utils.sshForNode().apply(node);
return ssh;
}
@Override
public ComputeService getJcloudsComputeService() {
return jcloudsComputeService;
}
>>>>>>>
@Override
public void detachVolume(String instanceId, String volumeId, boolean force) {
Validate.notEmpty(instanceId);
LOGGER.info(String.format("Detach volumes from instance %s in region %s.", instanceId, region));
try {
DetachVolumeRequest detachVolumeRequest = new DetachVolumeRequest();
detachVolumeRequest.setForce(force);
detachVolumeRequest.setInstanceId(instanceId);
detachVolumeRequest.setVolumeId(volumeId);
ec2Client().detachVolume(detachVolumeRequest);
} catch (AmazonServiceException e) {
if (e.getErrorCode().equals("InvalidInstanceID.NotFound")) {
throw new NotFoundException("AWS instance " + instanceId + " not found", e);
}
throw e;
}
}
@Override
public List<String> listAttachedVolumes(String instanceId, boolean includeRoot) {
Validate.notEmpty(instanceId);
LOGGER.info(String.format("Listing volumes attached to instance %s in region %s.", instanceId, region));
try {
List<String> volumeIds = new ArrayList<String>();
for (Instance instance : describeInstances(instanceId)) {
String rootDeviceName = instance.getRootDeviceName();
for (InstanceBlockDeviceMapping ibdm : instance.getBlockDeviceMappings()) {
EbsInstanceBlockDevice ebs = ibdm.getEbs();
if (ebs == null) {
continue;
}
String volumeId = ebs.getVolumeId();
if (Strings.isNullOrEmpty(volumeId)) {
continue;
}
if (!includeRoot && rootDeviceName != null) {
if (rootDeviceName.equals(ibdm.getDeviceName())) {
continue;
}
}
volumeIds.add(volumeId);
}
}
return volumeIds;
} catch (AmazonServiceException e) {
if (e.getErrorCode().equals("InvalidInstanceID.NotFound")) {
throw new NotFoundException("AWS instance " + instanceId + " not found", e);
}
throw e;
}
}
/**
* Describe a set of security groups
*
* @param groupNames the names of the groups to find
* @return a list of matching groups
*/
public List<SecurityGroup> describeSecurityGroups(String... groupNames) {
AmazonEC2 ec2Client = ec2Client();
DescribeSecurityGroupsRequest request = new DescribeSecurityGroupsRequest();
if (groupNames == null || groupNames.length == 0) {
LOGGER.info(String.format("Getting all EC2 security groups in region %s.", region));
} else {
LOGGER.info(String.format("Getting EC2 security groups for %d names in region %s.", groupNames.length,
region));
request.withGroupNames(groupNames);
}
DescribeSecurityGroupsResult result;
try {
result = ec2Client.describeSecurityGroups(request);
} catch (AmazonServiceException e) {
if (e.getErrorCode().equals("InvalidGroup.NotFound")) {
LOGGER.info("Got InvalidGroup.NotFound error for security groups; returning empty list");
return Collections.emptyList();
}
throw e;
}
List<SecurityGroup> securityGroups = result.getSecurityGroups();
LOGGER.info(String.format("Got %d EC2 security groups in region %s.", securityGroups.size(), region));
return securityGroups;
}
/**
* Create an (empty) EC2 security group.
*
* @param name
* Name of group to create
* @param description
* Description of group to create
* @return ID of created group
*/
public String createSecurityGroup(String vpcId, String name, String description) {
AmazonEC2 ec2Client = ec2Client();
CreateSecurityGroupRequest request = new CreateSecurityGroupRequest();
request.setGroupName(name);
request.setDescription(description);
request.setVpcId(vpcId);
LOGGER.info(String.format("Creating EC2 security group %s.", name));
CreateSecurityGroupResult result = ec2Client.createSecurityGroup(request);
return result.getGroupId();
}
/**
* Convenience wrapper around describeInstances, for a single instance id.
*
* @param instanceId id of instance to find
* @return the instance info, or null if instance not found
*/
public Instance describeInstance(String instanceId) {
Instance instance = null;
for (Instance i : describeInstances(instanceId)) {
if (instance != null) {
throw new IllegalStateException("Duplicate instance: " + instanceId);
}
instance = i;
}
return instance;
}
public NodeMetadata findJcloudsNode(String instanceId) {
List<String> instanceIds = Lists.newArrayList();
instanceIds.add(instanceId);
Set<? extends NodeMetadata> nodes = jcloudsComputeService.listNodesByIds(instanceIds);
if (nodes.isEmpty()) {
return null;
}
return Iterables.getOnlyElement(nodes);
}
@Override
public SshClient getJcloudsSsh(NodeMetadata node) {
Utils utils = jcloudsComputeService.getContext().getUtils();
SshClient ssh = utils.sshForNode().apply(node);
return ssh;
}
@Override
public ComputeService getJcloudsComputeService() {
return jcloudsComputeService;
} |
<<<<<<<
p.setProperty("hibernate.connection.driver_class", databaseDriverClass);
p.setProperty("hibernate.connection.url", jdbcURL);
/*
* fix mwiesner
* - needed to ensure working hsqldb queries - don't remove it...!
*/
p.setProperty("hibernate.connection.useUnicode","true");
=======
p.setProperty("hibernate.connection.driver_class", "com.mysql.jdbc.Driver");
p.setProperty("hibernate.connection.url", "jdbc:mysql://" + host + "/" + db);
>>>>>>>
p.setProperty("hibernate.connection.driver_class", databaseDriverClass);
p.setProperty("hibernate.connection.url", jdbcURL);
/*
* fix mwiesner
* - needed to ensure working hsqldb queries - don't remove it...!
*/
p.setProperty("hibernate.connection.useUnicode","true");
<<<<<<<
// p.setProperty("hibernate.connection.hibernate.connection.characterEncoding", "UTF-8");
// p.setProperty("hibernate.connection.hibernate.connection.clobCharacterEncoding","UTF-8");
// end fix
=======
p.setProperty("hibernate.connection.useUnicode","true");
>>>>>>>
// p.setProperty("hibernate.connection.hibernate.connection.characterEncoding", "UTF-8");
// p.setProperty("hibernate.connection.hibernate.connection.clobCharacterEncoding","UTF-8");
// end fix
<<<<<<<
// JDBC connection pool (use the built-in) -->
p.setProperty("hibernate.connection.pool_size","1");
=======
// SQL dialect
p.setProperty("hibernate.dialect","org.hibernate.dialect.MySQLDialect");
>>>>>>>
// JDBC connection pool (use the built-in) -->
p.setProperty("hibernate.connection.pool_size","1");
<<<<<<<
// Do only update schema on changes
p.setProperty("hibernate.hbm2ddl.auto","update");
=======
// Update schema
p.setProperty("hibernate.hbm2ddl.auto","validate");
// Avoid long running connection acquisition:
// Important performance fix to obtain jdbc connections a lot faster by avoiding metadata fetching
p.setProperty("hibernate.temp.use_jdbc_metadata_defaults","false");
// Set C3P0 Connection Pool in case somebody wants to use it in production settings
// if no C3P0 is available at runtime, related warnings can be ignored safely as the built-in CP will be used.
p.setProperty("hibernate.c3p0.acquire_increment","3");
p.setProperty("hibernate.c3p0.idle_test_period","300");
p.setProperty("hibernate.c3p0.min_size","3");
p.setProperty("hibernate.c3p0.max_size","15");
p.setProperty("hibernate.c3p0.max_statements","10");
p.setProperty("hibernate.c3p0.timeout","1000");
>>>>>>>
// Do only update schema on changes
p.setProperty("hibernate.hbm2ddl.auto","validate");
// Avoid long running connection acquisition:
// Important performance fix to obtain jdbc connections a lot faster by avoiding metadata fetching
p.setProperty("hibernate.temp.use_jdbc_metadata_defaults","false");
// Set C3P0 Connection Pool in case somebody wants to use it in production settings
// if no C3P0 is available at runtime, related warnings can be ignored safely as the built-in CP will be used.
p.setProperty("hibernate.c3p0.acquire_increment","3");
p.setProperty("hibernate.c3p0.idle_test_period","300");
p.setProperty("hibernate.c3p0.min_size","3");
p.setProperty("hibernate.c3p0.max_size","15");
p.setProperty("hibernate.c3p0.max_statements","10");
p.setProperty("hibernate.c3p0.timeout","1000"); |
<<<<<<<
import de.tudarmstadt.ukp.wikipedia.api.exception.WikiInitializationException;
=======
import de.tudarmstadt.ukp.wikipedia.api.WikiConstants.Language;
>>>>>>>
import de.tudarmstadt.ukp.wikipedia.api.WikiConstants.Language;
<<<<<<<
@Before
public void setupWikipedia() {
DatabaseConfiguration db = obtainHSDLDBConfiguration();
=======
private static Wikipedia wiki;
/**
* Made this static so that following tests don't run if assumption fails.
* (With AT_Before, tests also would not be executed but marked as passed)
* This could be changed back as soon as JUnit ignored tests after failed
* assumptions
*/
@BeforeClass
public static void setupWikipedia() {
DatabaseConfiguration db = new DatabaseConfiguration();
db.setDatabase("wikiapi_test");
db.setHost("bender.ukp.informatik.tu-darmstadt.de");
db.setUser("student");
db.setPassword("student");
db.setLanguage(Language._test);
>>>>>>>
@BeforeClass
public void setupWikipedia() {
DatabaseConfiguration db = obtainHSDLDBConfiguration(); |
<<<<<<<
public static final PollingStrategyConfig DEFAULT_POLLING_STRATEGY = new PollingStrategyConfig(
PollingStrategyConfig.Type.FETCH,
0.5,
UPPER_LIMIT_FRACTION_OF_THREADS_FOR_FETCH);
=======
public static final LogLevel DEFAULT_FAILURE_LOG_LEVEL = LogLevel.WARN;
public static final boolean LOG_STACK_TRACE_ON_FAILURE = true;
>>>>>>>
public static final PollingStrategyConfig DEFAULT_POLLING_STRATEGY = new PollingStrategyConfig(
PollingStrategyConfig.Type.FETCH,
0.5,
UPPER_LIMIT_FRACTION_OF_THREADS_FOR_FETCH);
public static final LogLevel DEFAULT_FAILURE_LOG_LEVEL = LogLevel.WARN;
public static final boolean LOG_STACK_TRACE_ON_FAILURE = true;
<<<<<<<
protected PollingStrategyConfig pollingStrategyConfig = DEFAULT_POLLING_STRATEGY;
=======
protected LogLevel logLevel = DEFAULT_FAILURE_LOG_LEVEL;
protected boolean logStackTrace = LOG_STACK_TRACE_ON_FAILURE;
>>>>>>>
protected PollingStrategyConfig pollingStrategyConfig = DEFAULT_POLLING_STRATEGY;
protected LogLevel logLevel = DEFAULT_FAILURE_LOG_LEVEL;
protected boolean logStackTrace = LOG_STACK_TRACE_ON_FAILURE;
<<<<<<<
public SchedulerBuilder pollUsingFetchAndLockOnExecute(double lowerLimitFractionOfThreads, double executionsPerBatchFractionOfThreads) {
this.pollingStrategyConfig = new PollingStrategyConfig(
PollingStrategyConfig.Type.FETCH,
lowerLimitFractionOfThreads, executionsPerBatchFractionOfThreads);
return this;
}
=======
public SchedulerBuilder failureLogging(LogLevel logLevel, boolean logStackTrace) {
if(logLevel == null) {
throw new IllegalArgumentException("Log level must not be null");
}
this.logLevel = logLevel;
this.logStackTrace = logStackTrace;
return this;
}
public Scheduler build() {
if (pollingLimit < executorThreads) {
LOG.warn("Polling-limit is less than number of threads. Should be equal or higher.");
}
>>>>>>>
public SchedulerBuilder pollUsingFetchAndLockOnExecute(double lowerLimitFractionOfThreads, double executionsPerBatchFractionOfThreads) {
this.pollingStrategyConfig = new PollingStrategyConfig(
PollingStrategyConfig.Type.FETCH,
lowerLimitFractionOfThreads, executionsPerBatchFractionOfThreads);
return this;
}
<<<<<<<
schedulerName, waiter, heartbeatInterval, enableImmediateExecution, statsRegistry, pollingStrategyConfig,
deleteUnresolvedAfter, shutdownMaxWait, startTasks);
=======
schedulerName, waiter, heartbeatInterval, enableImmediateExecution, statsRegistry, pollingLimit,
deleteUnresolvedAfter, shutdownMaxWait, logLevel, logStackTrace, startTasks);
>>>>>>>
schedulerName, waiter, heartbeatInterval, enableImmediateExecution, statsRegistry, pollingStrategyConfig, pollingLimit,
deleteUnresolvedAfter, shutdownMaxWait, logLevel, logStackTrace, startTasks); |
<<<<<<<
private static final long serialVersionUID = 3602287822306302730L;
private static final Gson GSON = new GsonBuilder()
.registerTypeHierarchyAdapter(Collection.class, new CollectionSerializer())
.registerTypeHierarchyAdapter(Map.class, new MapSerializer())
.registerTypeHierarchyAdapter(Optional.class, new OptionalSerializer())
.registerTypeAdapter(Suite.Timestamp.class, new TimestampSerializer())
.create();
private static final Type SUITE_TYPE = new TypeToken<Suite>() {
}.getType();
=======
private static final long serialVersionUID = -4621145477713271743L;
>>>>>>>
private static final long serialVersionUID = 3602287822306302730L;
private static final Gson GSON = new GsonBuilder()
.registerTypeHierarchyAdapter(Collection.class, new CollectionSerializer())
.registerTypeHierarchyAdapter(Map.class, new MapSerializer())
.registerTypeHierarchyAdapter(Optional.class, new OptionalSerializer())
.registerTypeAdapter(Suite.Timestamp.class, new TimestampSerializer())
.create();
private static final Type SUITE_TYPE = new TypeToken<Suite>() {
}.getType();
<<<<<<<
private Optional<String> patternSuite;
private String comment;
=======
>>>>>>>
private Optional<String> patternSuite;
<<<<<<<
public Optional<String> getPatternSuite() {
return patternSuite;
}
public void setPatternSuite(Optional<String> patternSuite) {
this.patternSuite = patternSuite;
}
=======
public Statistics getStatistics() {
return statistics;
}
public void setStatistics(Statistics statistics) {
this.statistics = statistics;
}
public Timestamp getFinishedTimestamp() {
return finishedTimestamp;
}
public void setFinishedTimestamp(
Timestamp finishedTimestamp) {
this.finishedTimestamp = finishedTimestamp;
}
>>>>>>>
public Optional<String> getPatternSuite() {
return patternSuite;
}
public void setPatternSuite(Optional<String> patternSuite) {
this.patternSuite = patternSuite;
}
public Statistics getStatistics() {
return statistics;
}
public void setStatistics(Statistics statistics) {
this.statistics = statistics;
}
public Timestamp getFinishedTimestamp() {
return finishedTimestamp;
}
public void setFinishedTimestamp(
Timestamp finishedTimestamp) {
this.finishedTimestamp = finishedTimestamp;
} |
<<<<<<<
import com.cognifide.aet.runner.processing.data.RunIndexWrapper;
=======
import com.cognifide.aet.communication.api.messages.FullProgressLog;
import com.cognifide.aet.runner.processing.data.SuiteIndexWrapper;
>>>>>>>
import com.cognifide.aet.runner.processing.data.RunIndexWrapper;
import com.cognifide.aet.communication.api.messages.FullProgressLog; |
<<<<<<<
static final String RERUN_PART_PATH = "rerun";
=======
static final String HISTORY_PART_PATH = "history";
>>>>>>>
static final String RERUN_PART_PATH = "rerun";
static final String HISTORY_PART_PATH = "history"; |
<<<<<<<
import com.cognifide.aet.job.api.exceptions.ProcessingException;
import com.cognifide.aet.job.common.utils.javascript.JavaScriptJobExecutor;
=======
import com.cognifide.aet.job.common.utils.Sampler;
>>>>>>>
import com.cognifide.aet.job.api.exceptions.ProcessingException;
import com.cognifide.aet.job.common.utils.javascript.JavaScriptJobExecutor;
import com.cognifide.aet.job.common.utils.Sampler;
<<<<<<<
=======
private static final String SAMPLING_PERIOD_PARAM = "samplingPeriod";
>>>>>>>
private static final String SAMPLING_PERIOD_PARAM = "samplingPeriod";
<<<<<<<
private static final int MAX_SIZE = 35000;
=======
private static final int HEIGHT_MAX_SIZE = 35000;
>>>>>>>
private static final int HEIGHT_MAX_SIZE = 35000;
<<<<<<<
public CollectorStepResult collect() throws ProcessingException {
setResolution();
=======
public CollectorStepResult collect() {
setResolution(this.webDriver);
>>>>>>>
public CollectorStepResult collect() throws ProcessingException {
setResolution();
<<<<<<<
private void setResolution() throws ProcessingException {
Window window = webDriver.manage().window();
=======
private void setHeight(Map<String, String> params) throws ParametersException {
height = NumberUtils.toInt(params.get(HEIGHT_PARAM));
ParametersValidator
.checkRange(height, 1, HEIGHT_MAX_SIZE,
"Height should be greater than 0 and smaller than " + HEIGHT_MAX_SIZE);
}
private void setHeightSamplingPeriod(Map<String, String> params) throws ParametersException {
samplingPeriod = NumberUtils
.toInt(params.get(SAMPLING_PERIOD_PARAM), DEFAULT_SAMPLING_WAIT_PERIOD);
ParametersValidator
.checkRange(samplingPeriod, 0, MAX_SAMPLING_PERIOD,
"samplingPeriod should be greater than or equal 0 and smaller or equal "
+ MAX_SAMPLING_PERIOD);
}
private void setResolution(WebDriver webDriver) {
>>>>>>>
private void setHeight(Map<String, String> params) throws ParametersException {
height = NumberUtils.toInt(params.get(HEIGHT_PARAM));
ParametersValidator
.checkRange(height, 1, HEIGHT_MAX_SIZE,
"Height should be greater than 0 and smaller than " + HEIGHT_MAX_SIZE);
}
private void setHeightSamplingPeriod(Map<String, String> params) throws ParametersException {
samplingPeriod = NumberUtils
.toInt(params.get(SAMPLING_PERIOD_PARAM), DEFAULT_SAMPLING_WAIT_PERIOD);
ParametersValidator
.checkRange(samplingPeriod, 0, MAX_SAMPLING_PERIOD,
"samplingPeriod should be greater than or equal 0 and smaller or equal "
+ MAX_SAMPLING_PERIOD);
}
private void setResolution() throws ProcessingException {
<<<<<<<
window.setSize(new Dimension(width, INITIAL_HEIGHT));
height = getBodyHeight();
if (height > MAX_SIZE) {
LOG.warn("Height is over browser limit, changing height to {}", MAX_SIZE);
height = MAX_SIZE;
=======
height = calculateWindowHeight(webDriver);
if (height > HEIGHT_MAX_SIZE) {
LOG.warn("Height is over browser limit, changing height to {}", HEIGHT_MAX_SIZE);
height = HEIGHT_MAX_SIZE;
>>>>>>>
height = calculateWindowHeight();
if (height > HEIGHT_MAX_SIZE) {
LOG.warn("Height is over browser limit, changing height to {}", HEIGHT_MAX_SIZE);
height = HEIGHT_MAX_SIZE;
} else if (height == HEIGHT_NOT_CALCULATED) {
throw new ProcessingException("Failed to calculate height, could not parse javascript result to integer"); |
<<<<<<<
import java.io.File;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
=======
import org.apache.commons.lang3.StringUtils;
>>>>>>>
import java.io.File;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.commons.lang3.StringUtils; |
<<<<<<<
ManualScheduler(SettableClock clock, TaskRepository schedulerTaskRepository, TaskRepository clientTaskRepository,
TaskResolver taskResolver, int maxThreads, ExecutorService executorService, SchedulerName schedulerName,
Waiter waiter, Duration heartbeatInterval, boolean executeImmediately, StatsRegistry statsRegistry,
PollingStrategyConfig pollingStrategyConfig, Duration deleteUnresolvedAfter,
List<OnStartup> onStartup) {
super(clock, schedulerTaskRepository, clientTaskRepository, taskResolver, maxThreads, executorService, schedulerName, waiter, heartbeatInterval, executeImmediately, statsRegistry, pollingStrategyConfig, deleteUnresolvedAfter, Duration.ZERO, onStartup);
=======
ManualScheduler(SettableClock clock, TaskRepository schedulerTaskRepository, TaskRepository clientTaskRepository, TaskResolver taskResolver, int maxThreads, ExecutorService executorService, SchedulerName schedulerName, Waiter waiter, Duration heartbeatInterval, boolean executeImmediately, StatsRegistry statsRegistry, int pollingLimit, Duration deleteUnresolvedAfter, LogLevel logLevel, boolean logStackTrace, List<OnStartup> onStartup) {
super(clock, schedulerTaskRepository, clientTaskRepository, taskResolver, maxThreads, executorService, schedulerName, waiter, heartbeatInterval, executeImmediately, statsRegistry, pollingLimit, deleteUnresolvedAfter, Duration.ZERO, logLevel, logStackTrace, onStartup);
>>>>>>>
ManualScheduler(SettableClock clock, TaskRepository schedulerTaskRepository, TaskRepository clientTaskRepository,
TaskResolver taskResolver, int maxThreads, ExecutorService executorService, SchedulerName schedulerName,
Waiter waiter, Duration heartbeatInterval, boolean executeImmediately, StatsRegistry statsRegistry,
PollingStrategyConfig pollingStrategyConfig, Duration deleteUnresolvedAfter,
LogLevel logLevel, boolean logStackTrace, List<OnStartup> onStartup) {
super(clock, schedulerTaskRepository, clientTaskRepository, taskResolver, maxThreads, executorService, schedulerName, waiter, heartbeatInterval, executeImmediately, statsRegistry, pollingStrategyConfig, deleteUnresolvedAfter, Duration.ZERO, logLevel, logStackTrace, onStartup); |
<<<<<<<
return new Scheduler(clock, taskRepository, taskResolver, 1, executor, new SchedulerName.Fixed("name"), new Waiter(Duration.ZERO), Duration.ofSeconds(1), false, false, StatsRegistry.NOOP, new ArrayList<>());
=======
return new Scheduler(clock, taskRepository, taskResolver, 1, executor, new SchedulerName.Fixed("name"), new Waiter(Duration.ZERO), Duration.ofSeconds(1), false, StatsRegistry.NOOP, 10_000, new ArrayList<>());
>>>>>>>
return new Scheduler(clock, taskRepository, taskResolver, 1, executor, new SchedulerName.Fixed("name"), new Waiter(Duration.ZERO), Duration.ofSeconds(1), false, false, StatsRegistry.NOOP, 10_000, new ArrayList<>()); |
<<<<<<<
import org.hawkular.alerts.actions.api.PluginMessage;
import org.hawkular.alerts.api.model.event.Alert;
import org.hawkular.alerts.api.model.event.Alert.Status;
import org.hawkular.alerts.api.model.event.Event;
=======
import org.hawkular.alerts.actions.api.Plugin;
import org.hawkular.alerts.actions.api.Sender;
import org.hawkular.alerts.api.json.JsonUtil;
import org.hawkular.alerts.api.model.action.Action;
import org.hawkular.alerts.api.model.condition.Alert;
import org.hawkular.alerts.api.model.condition.Alert.Status;
>>>>>>>
import org.hawkular.alerts.actions.api.Plugin;
import org.hawkular.alerts.actions.api.Sender;
import org.hawkular.alerts.api.json.JsonUtil;
import org.hawkular.alerts.api.model.action.Action;
import org.hawkular.alerts.api.model.event.Alert;
import org.hawkular.alerts.api.model.event.Alert.Status;
import org.hawkular.alerts.api.model.event.Event; |
<<<<<<<
import org.hawkular.alerts.actions.api.PluginMessage;
=======
import org.hawkular.alerts.actions.api.ActionMessage;
import org.hawkular.alerts.api.model.Severity;
>>>>>>>
import org.hawkular.alerts.actions.api.ActionMessage;
<<<<<<<
assertEquals("v2", newMsg.getProperties().get("k2"));
System.out.println(newMsg.getAction().getEvent());
assertTrue(newMsg.getAction().getEvent().getId().startsWith("trigger-test"));
=======
assertEquals("v2", newMsg.getAction().getProperties().get("k2"));
assertEquals("trigger-test", newMsg.getAction().getAlert().getTriggerId());
>>>>>>>
assertEquals("v2", newMsg.getAction().getProperties().get("k2"));
assertEquals("trigger-test", newMsg.getAction().getEvent().getTrigger().getId()); |
<<<<<<<
import javax.ejb.Singleton;
import org.hawkular.alerts.api.model.Severity;
=======
import javax.ejb.Stateless;
>>>>>>>
import javax.ejb.Stateless;
import org.hawkular.alerts.api.model.Severity;
<<<<<<<
private PreparedStatement insertAlert;
private PreparedStatement insertAlertTrigger;
private PreparedStatement insertAlertCtime;
private PreparedStatement insertAlertStatus;
private PreparedStatement insertAlertSeverity;
private PreparedStatement updateAlert;
private PreparedStatement selectAlertStatus;
private PreparedStatement deleteAlertStatus;
private PreparedStatement selectAlertsByTenant;
private PreparedStatement selectAlertsByTenantAndAlert;
private PreparedStatement selectAlertsTriggers;
private PreparedStatement selectAlertCTimeStartEnd;
private PreparedStatement selectAlertCTimeStart;
private PreparedStatement selectAlertCTimeEnd;
private PreparedStatement selectAlertStatusByTenantAndStatus;
private PreparedStatement selectAlertSeverityByTenantAndSeverity;
private PreparedStatement selectTagsTriggersByCategoryAndName;
private PreparedStatement selectTagsTriggersByCategory;
private PreparedStatement selectTagsTriggersByName;
private final List<Data> pendingData;
private final List<Alert> alerts;
private final Set<Dampening> pendingTimeouts;
private final Map<Trigger, List<Set<ConditionEval>>> autoResolvedTriggers;
private final Set<Trigger> disabledTriggers;
private final Timer wakeUpTimer;
private TimerTask rulesTask;
=======
>>>>>>>
<<<<<<<
pendingData = new CopyOnWriteArrayList<>();
alerts = new CopyOnWriteArrayList<>();
pendingTimeouts = new CopyOnWriteArraySet<>();
autoResolvedTriggers = new HashMap<>();
disabledTriggers = new CopyOnWriteArraySet<>();
wakeUpTimer = new Timer("CassAlertsServiceImpl-Timer");
delay = new Integer(AlertProperties.getProperty(ENGINE_DELAY, "1000"));
period = new Integer(AlertProperties.getProperty(ENGINE_PERIOD, "2000"));
}
public ActionsService getActions() {
return actions;
}
public void setActions(ActionsService actions) {
this.actions = actions;
}
public DefinitionsService getDefinitions() {
return definitions;
}
public void setDefinitions(DefinitionsService definitions) {
this.definitions = definitions;
}
public RulesEngine getRules() {
return rules;
}
public void setRules(RulesEngine rules) {
this.rules = rules;
=======
>>>>>>>
<<<<<<<
@PreDestroy
public void shutdown() {
if (session != null) {
session.close();
}
}
private void initPreparedStatements() throws Exception {
if (insertAlert == null) {
insertAlert = session.prepare("INSERT INTO " + keyspace + ".alerts " +
"(tenantId, alertId, payload) VALUES (?, ?, ?) ");
}
if (insertAlertTrigger == null) {
insertAlertTrigger = session.prepare("INSERT INTO " + keyspace + ".alerts_triggers " +
"(tenantId, alertId, triggerId) VALUES (?, ?, ?) ");
}
if (insertAlertCtime == null) {
insertAlertCtime = session.prepare("INSERT INTO " + keyspace + ".alerts_ctimes " +
"(tenantId, alertId, ctime) VALUES (?, ?, ?) ");
}
if (insertAlertStatus == null) {
insertAlertStatus = session.prepare("INSERT INTO " + keyspace + ".alerts_statuses " +
"(tenantId, alertId, status) VALUES (?, ?, ?) ");
}
if (insertAlertSeverity == null) {
insertAlertSeverity = session.prepare("INSERT INTO " + keyspace + ".alerts_severities " +
"(tenantId, alertId, severity) VALUES (?, ?, ?) ");
}
if (updateAlert == null) {
updateAlert = session.prepare("UPDATE " + keyspace + ".alerts " +
"SET payload = ? WHERE tenantId = ? AND alertId = ? ");
}
if (selectAlertStatus == null) {
selectAlertStatus = session.prepare("SELECT alertId, status FROM " + keyspace + ".alerts_statuses " +
"WHERE tenantId = ? AND status = ? AND alertId = ? ");
}
if (deleteAlertStatus == null) {
deleteAlertStatus = session.prepare("DELETE FROM " + keyspace + ".alerts_statuses " +
"WHERE tenantId = ? AND status = ? AND alertId = ? ");
}
if (selectAlertsByTenant == null) {
selectAlertsByTenant = session.prepare("SELECT payload FROM " + keyspace + ".alerts " +
"WHERE tenantId = ? ");
}
if (selectAlertsByTenantAndAlert == null) {
selectAlertsByTenantAndAlert = session.prepare("SELECT payload FROM " + keyspace + ".alerts " +
"WHERE tenantId = ? AND alertId = ? ");
}
if (selectAlertsTriggers == null) {
selectAlertsTriggers = session.prepare("SELECT alertId FROM " + keyspace + ".alerts_triggers " +
"WHERE tenantId = ? AND " + "triggerId = ? ");
}
if (selectAlertCTimeStartEnd == null) {
selectAlertCTimeStartEnd = session.prepare("SELECT alertId FROM " + keyspace + ".alerts_ctimes " +
"WHERE tenantId = ? AND ctime >= ? AND ctime <= ?");
}
if (selectAlertCTimeStart == null) {
selectAlertCTimeStart = session.prepare("SELECT alertId FROM " + keyspace + ".alerts_ctimes " +
"WHERE tenantId = ? AND ctime >= ?");
}
if (selectAlertCTimeEnd == null) {
selectAlertCTimeEnd = session.prepare("SELECT alertId FROM " + keyspace + ".alerts_ctimes " +
"WHERE tenantId = ? AND ctime <= ?");
}
if (selectAlertStatusByTenantAndStatus == null) {
selectAlertStatusByTenantAndStatus = session.prepare("SELECT alertId FROM " + keyspace + "" +
".alerts_statuses WHERE tenantId = ? AND status = ?");
}
if (selectAlertSeverityByTenantAndSeverity == null) {
selectAlertSeverityByTenantAndSeverity = session.prepare("SELECT alertId FROM " + keyspace + "" +
".alerts_severities WHERE tenantId = ? AND severity = ?");
}
if (selectTagsTriggersByCategoryAndName == null) {
selectTagsTriggersByCategoryAndName = session.prepare("SELECT triggers FROM " + keyspace + "" +
".tags_triggers WHERE tenantId = ? AND category = ? AND name = ?");
}
if (selectTagsTriggersByCategory == null) {
selectTagsTriggersByCategory = session.prepare("SELECT triggers FROM " + keyspace + "" +
".tags_triggers WHERE tenantId = ? AND category = ?");
}
if (selectTagsTriggersByName == null) {
selectTagsTriggersByName = session.prepare("SELECT triggers FROM " + keyspace + "" +
".tags_triggers WHERE tenantId = ? AND name = ?");
}
}
=======
>>>>>>>
<<<<<<<
alerts.stream()
.forEach(
a -> {
futures.add(session.executeAsync(insertAlert.bind(a.getTenantId(), a.getAlertId(),
toJson(a))));
futures.add(session.executeAsync(insertAlertTrigger.bind(a.getTenantId(),
a.getAlertId(),
a.getTriggerId())));
futures.add(session.executeAsync(insertAlertCtime.bind(a.getTenantId(),
a.getAlertId(), a.getCtime())));
futures.add(session.executeAsync(insertAlertStatus.bind(a.getTenantId(),
a.getAlertId(),
a.getStatus().name())));
futures.add(session.executeAsync(insertAlertSeverity.bind(a.getTenantId(),
a.getAlertId(),
a.getSeverity().name())));
});
=======
alerts.stream()
.forEach(a -> {
futures.add(session.executeAsync(insertAlert.bind(a.getTenantId(), a.getAlertId(),
toJson(a))));
futures.add(session.executeAsync(insertAlertTrigger.bind(a.getTenantId(),
a.getAlertId(),
a.getTriggerId())));
futures.add(session.executeAsync(insertAlertCtime.bind(a.getTenantId(),
a.getAlertId(), a.getCtime())));
futures.add(session.executeAsync(insertAlertStatus.bind(a.getTenantId(),
a.getAlertId(),
a.getStatus().name())));
});
>>>>>>>
alerts.stream()
.forEach(a -> {
futures.add(session.executeAsync(insertAlert.bind(a.getTenantId(), a.getAlertId(),
toJson(a))));
futures.add(session.executeAsync(insertAlertTrigger.bind(a.getTenantId(),
a.getAlertId(),
a.getTriggerId())));
futures.add(session.executeAsync(insertAlertCtime.bind(a.getTenantId(),
a.getAlertId(), a.getCtime())));
futures.add(session.executeAsync(insertAlertStatus.bind(a.getTenantId(),
a.getAlertId(),
a.getStatus().name())));
futures.add(session.executeAsync(insertAlertSeverity.bind(a.getTenantId(),
a.getAlertId(),
a.getSeverity().name())));
}); |
<<<<<<<
return null != startTime //
|| null != endTime
|| null != status
|| null != severity
|| null != triggerId
|| null != tag
|| (null != statusSet && !statusSet.isEmpty())
|| (null != severities && !severities.isEmpty())
|| (null != triggerIds && !triggerIds.isEmpty())
|| (null != tags && !tags.isEmpty());
=======
return null != startTime || //
null != endTime || //
null != triggerId || //
(null != triggerIds && !triggerIds.isEmpty()) || //
null != alertId || //
(null != alertIds && !alertIds.isEmpty()) || //
null != tag || //
(null != tags && !tags.isEmpty()) ||
null != status ||
(null != statusSet && !statusSet.isEmpty());
>>>>>>>
return null != startTime //
|| null != endTime
|| null != status
|| null != severity
|| null != triggerId
|| null != alertId
|| null != tag
|| (null != statusSet && !statusSet.isEmpty())
|| (null != severities && !severities.isEmpty())
|| (null != triggerIds && !triggerIds.isEmpty())
|| (null != alertIds && !alertIds.isEmpty())
|| (null != tags && !tags.isEmpty()); |
<<<<<<<
=======
import com.github.kagkarlsson.scheduler.concurrent.LoggingRunnable;
import com.github.kagkarlsson.scheduler.logging.ConfigurableLogger;
import com.github.kagkarlsson.scheduler.logging.LogLevel;
>>>>>>>
import com.github.kagkarlsson.scheduler.concurrent.LoggingRunnable;
import com.github.kagkarlsson.scheduler.logging.ConfigurableLogger;
import com.github.kagkarlsson.scheduler.logging.LogLevel;
<<<<<<<
final SettableSchedulerState schedulerState = new SettableSchedulerState();
=======
private final SettableSchedulerState schedulerState = new SettableSchedulerState();
private int currentGenerationNumber = 1;
private final ConfigurableLogger failureLogger;
>>>>>>>
final SettableSchedulerState schedulerState = new SettableSchedulerState();
private int currentGenerationNumber = 1;
private final ConfigurableLogger failureLogger;
<<<<<<<
Waiter executeDueWaiter, Duration heartbeatInterval, boolean enableImmediateExecution, StatsRegistry statsRegistry, PollingStrategyConfig pollingStrategyConfig, Duration deleteUnresolvedAfter, Duration shutdownMaxWait, List<OnStartup> onStartup) {
=======
Waiter executeDueWaiter, Duration heartbeatInterval, boolean enableImmediateExecution, StatsRegistry statsRegistry, int pollingLimit, Duration deleteUnresolvedAfter, Duration shutdownMaxWait,
LogLevel logLevel, boolean logStackTrace, List<OnStartup> onStartup) {
>>>>>>>
Waiter executeDueWaiter, Duration heartbeatInterval, boolean enableImmediateExecution, StatsRegistry statsRegistry, PollingStrategyConfig pollingStrategyConfig, Duration deleteUnresolvedAfter, Duration shutdownMaxWait,
LogLevel logLevel, boolean logStackTrace, List<OnStartup> onStartup) {
<<<<<<<
if (pollingStrategyConfig.type == PollingStrategyConfig.Type.LOCK_AND_FETCH) {
schedulerTaskRepository.checkSupportsLockAndFetch();
executeDueStrategy = new LockAndFetchCandidates(this, pollingStrategyConfig);
} else if (pollingStrategyConfig.type == PollingStrategyConfig.Type.FETCH) {
executeDueStrategy = new FetchCandidates(this, pollingStrategyConfig);
} else {
throw new IllegalArgumentException("Unknown polling-strategy type: " + pollingStrategyConfig.type);
}
=======
this.failureLogger = ConfigurableLogger.create(LOG, logLevel, logStackTrace);
>>>>>>>
if (pollingStrategyConfig.type == PollingStrategyConfig.Type.LOCK_AND_FETCH) {
schedulerTaskRepository.checkSupportsLockAndFetch();
executeDueStrategy = new LockAndFetchCandidates(this, pollingStrategyConfig);
} else if (pollingStrategyConfig.type == PollingStrategyConfig.Type.FETCH) {
executeDueStrategy = new FetchCandidates(this, pollingStrategyConfig);
} else {
throw new IllegalArgumentException("Unknown polling-strategy type: " + pollingStrategyConfig.type);
}
this.failureLogger = ConfigurableLogger.create(LOG, logLevel, logStackTrace);
<<<<<<<
return executor.getCurrentlyExecuting();
=======
return new ArrayList<>(currentlyProcessing.values());
}
protected void executeDue() {
Instant now = clock.now();
List<Execution> dueExecutions = schedulerTaskRepository.getDue(now, pollingLimit);
LOG.trace("Found {} task instances due for execution", dueExecutions.size());
this.currentGenerationNumber = this.currentGenerationNumber + 1;
DueExecutionsBatch newDueBatch = new DueExecutionsBatch(Scheduler.this.threadpoolSize, currentGenerationNumber, dueExecutions.size(), pollingLimit == dueExecutions.size());
for (Execution e : dueExecutions) {
executorService.execute(new PickAndExecute(e, newDueBatch));
}
statsRegistry.register(SchedulerStatsEvent.RAN_EXECUTE_DUE);
>>>>>>>
return executor.getCurrentlyExecuting();
<<<<<<<
=======
private class PickAndExecute extends LoggingRunnable {
private Execution candidate;
private DueExecutionsBatch addedDueExecutionsBatch;
public PickAndExecute(Execution candidate, DueExecutionsBatch dueExecutionsBatch) {
this.candidate = candidate;
this.addedDueExecutionsBatch = dueExecutionsBatch;
}
@Override
public void runButLogExceptions() {
if (schedulerState.isShuttingDown()) {
LOG.info("Scheduler has been shutdown. Skipping fetched due execution: " + candidate.taskInstance.getTaskAndInstance());
return;
}
try {
if (addedDueExecutionsBatch.isOlderGenerationThan(currentGenerationNumber)) {
// skipping execution due to it being stale
addedDueExecutionsBatch.markBatchAsStale();
statsRegistry.register(StatsRegistry.CandidateStatsEvent.STALE);
LOG.trace("Skipping queued execution (current generationNumber: {}, execution generationNumber: {})", currentGenerationNumber, addedDueExecutionsBatch.getGenerationNumber());
return;
}
final Optional<Execution> pickedExecution = schedulerTaskRepository.pick(candidate, clock.now());
if (!pickedExecution.isPresent()) {
// someone else picked id
LOG.debug("Execution picked by another scheduler. Continuing to next due execution.");
statsRegistry.register(StatsRegistry.CandidateStatsEvent.ALREADY_PICKED);
return;
}
currentlyProcessing.put(pickedExecution.get(), new CurrentlyExecuting(pickedExecution.get(), clock));
try {
statsRegistry.register(StatsRegistry.CandidateStatsEvent.EXECUTED);
executePickedExecution(pickedExecution.get());
} finally {
if (currentlyProcessing.remove(pickedExecution.get()) == null) {
// May happen in rare circumstances (typically concurrency tests)
LOG.warn("Released execution was not found in collection of executions currently being processed. Should never happen.");
}
}
} finally {
// Make sure 'executionsLeftInBatch' is decremented for all executions (run or not run)
addedDueExecutionsBatch.oneExecutionDone(Scheduler.this::triggerCheckForDueExecutions);
}
}
private void executePickedExecution(Execution execution) {
final Optional<Task> task = taskResolver.resolve(execution.taskInstance.getTaskName());
if (!task.isPresent()) {
LOG.error("Failed to find implementation for task with name '{}'. Should have been excluded in JdbcRepository.", execution.taskInstance.getTaskName());
statsRegistry.register(SchedulerStatsEvent.UNEXPECTED_ERROR);
return;
}
Instant executionStarted = clock.now();
try {
LOG.debug("Executing " + execution);
CompletionHandler completion = task.get().execute(execution.taskInstance, new ExecutionContext(schedulerState, execution, Scheduler.this));
LOG.debug("Execution done");
complete(completion, execution, executionStarted);
statsRegistry.register(StatsRegistry.ExecutionStatsEvent.COMPLETED);
} catch (RuntimeException unhandledException) {
failure(task.get(), execution, unhandledException, executionStarted, "Unhandled exception");
statsRegistry.register(StatsRegistry.ExecutionStatsEvent.FAILED);
} catch (Throwable unhandledError) {
failure(task.get(), execution, unhandledError, executionStarted, "Error");
statsRegistry.register(StatsRegistry.ExecutionStatsEvent.FAILED);
}
}
private void complete(CompletionHandler completion, Execution execution, Instant executionStarted) {
ExecutionComplete completeEvent = ExecutionComplete.success(execution, executionStarted, clock.now());
try {
completion.complete(completeEvent, new ExecutionOperations(schedulerTaskRepository, execution));
statsRegistry.registerSingleCompletedExecution(completeEvent);
} catch (Throwable e) {
statsRegistry.register(SchedulerStatsEvent.COMPLETIONHANDLER_ERROR);
statsRegistry.register(SchedulerStatsEvent.UNEXPECTED_ERROR);
LOG.error("Failed while completing execution {}. Execution will likely remain scheduled and locked/picked. " +
"The execution should be detected as dead in {}, and handled according to the tasks DeadExecutionHandler.", execution, getMaxAgeBeforeConsideredDead(), e);
}
}
private void failure(Task task, Execution execution, Throwable cause, Instant executionStarted, String errorMessagePrefix) {
String logMessage = errorMessagePrefix + " during execution of task with name '{}'. Treating as failure.";
failureLogger.log(logMessage, cause, task.getName());
ExecutionComplete completeEvent = ExecutionComplete.failure(execution, executionStarted, clock.now(), cause);
try {
task.getFailureHandler().onFailure(completeEvent, new ExecutionOperations(schedulerTaskRepository, execution));
statsRegistry.registerSingleCompletedExecution(completeEvent);
} catch (Throwable e) {
statsRegistry.register(SchedulerStatsEvent.FAILUREHANDLER_ERROR);
statsRegistry.register(SchedulerStatsEvent.UNEXPECTED_ERROR);
LOG.error("Failed while completing execution {}. Execution will likely remain scheduled and locked/picked. " +
"The execution should be detected as dead in {}, and handled according to the tasks DeadExecutionHandler.", execution, getMaxAgeBeforeConsideredDead(), e);
}
}
}
>>>>>>> |
<<<<<<<
if (vexp.getAccessedVariable() instanceof DynamicVariable) {
addStaticTypeError("Variable ["+vexp.getName()+"] is undefined", vexp);
}
=======
if (vexp.getAccessedVariable() instanceof DynamicVariable) {
addStaticTypeError("The variable "+vexp.getName()+" is undeclared.",vexp);
}
>>>>>>>
if (vexp.getAccessedVariable() instanceof DynamicVariable) {
addStaticTypeError("The variable ["+vexp.getName()+"] is undeclared.",vexp);
} |
<<<<<<<
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
=======
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.Writer;
>>>>>>>
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.Writer;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; |
<<<<<<<
if (rType!=null && trySubscript(receiver, message, arguments, rType, aType, safe)) {
=======
if (receiver instanceof VariableExpression && receiver.getNodeMetaData().isEmpty()) {
// TODO: can STCV be made smarter to avoid this check?
VariableExpression ve = (VariableExpression) ((VariableExpression)receiver).getAccessedVariable();
rType = ve.getNodeMetaData(StaticTypesMarker.INFERRED_TYPE);
}
if (rType!=null && trySubscript(receiver, message, arguments, rType, aType)) {
>>>>>>>
if (receiver instanceof VariableExpression && receiver.getNodeMetaData().isEmpty()) {
// TODO: can STCV be made smarter to avoid this check?
VariableExpression ve = (VariableExpression) ((VariableExpression)receiver).getAccessedVariable();
rType = ve.getNodeMetaData(StaticTypesMarker.INFERRED_TYPE);
}
if (rType!=null && trySubscript(receiver, message, arguments, rType, aType, safe)) { |
<<<<<<<
import org.codehaus.groovy.ast.expr.BinaryExpression;
=======
import org.codehaus.groovy.ast.expr.ClassExpression;
import org.codehaus.groovy.ast.expr.ClosureExpression;
>>>>>>>
<<<<<<<
=======
import static org.codehaus.groovy.ast.tools.GeneralUtils.params;
import static org.codehaus.groovy.ast.tools.GeneralUtils.prop;
import static org.codehaus.groovy.ast.tools.GeneralUtils.returnS;
import static org.codehaus.groovy.ast.tools.GeneralUtils.stmt;
import static org.codehaus.groovy.ast.tools.GeneralUtils.var;
import static org.codehaus.groovy.ast.tools.GenericsUtils.correctToGenericsSpec;
import static org.codehaus.groovy.ast.tools.GenericsUtils.correctToGenericsSpecRecurse;
>>>>>>>
import static org.codehaus.groovy.ast.tools.GeneralUtils.params;
import static org.codehaus.groovy.ast.tools.GeneralUtils.prop;
import static org.codehaus.groovy.ast.tools.GeneralUtils.returnS;
import static org.codehaus.groovy.ast.tools.GeneralUtils.stmt;
import static org.codehaus.groovy.ast.tools.GeneralUtils.var;
<<<<<<<
final ArrayList<AnnotationNode> notCopied = new ArrayList<AnnotationNode>();
copyAnnotatedNodeAnnotations(annotatedNode, delegateAnnotations, notCopied);
for (AnnotationNode annotation : notCopied) {
addError(MY_TYPE_NAME + " does not support keeping Closure annotation members.", annotation);
=======
final ClassNode retentionClassNode = ClassHelper.makeWithoutCaching(Retention.class);
for (AnnotationNode annotation : candidateAnnotations) {
List<AnnotationNode> annotations = annotation.getClassNode().getAnnotations(retentionClassNode);
if (annotations.isEmpty()) continue;
if (hasClosureMember(annotation)) {
addError(MY_TYPE_NAME + " does not support keeping Closure annotation members.", annotation);
continue;
}
AnnotationNode retentionPolicyAnnotation = annotations.get(0);
Expression valueExpression = retentionPolicyAnnotation.getMember("value");
if (!(valueExpression instanceof PropertyExpression)) continue;
PropertyExpression propertyExpression = (PropertyExpression) valueExpression;
boolean processAnnotation =
propertyExpression.getProperty() instanceof ConstantExpression &&
(
"RUNTIME".equals(((ConstantExpression) (propertyExpression.getProperty())).getValue()) ||
"CLASS".equals(((ConstantExpression) (propertyExpression.getProperty())).getValue())
);
if (processAnnotation) {
AnnotationNode newAnnotation = new AnnotationNode(annotation.getClassNode());
for (Map.Entry<String, Expression> member : annotation.getMembers().entrySet()) {
newAnnotation.addMember(member.getKey(), member.getValue());
}
newAnnotation.setSourcePosition(annotatedNode);
delegateAnnotations.add(newAnnotation);
}
>>>>>>>
final ArrayList<AnnotationNode> notCopied = new ArrayList<AnnotationNode>();
copyAnnotatedNodeAnnotations(annotatedNode, delegateAnnotations, notCopied);
for (AnnotationNode annotation : notCopied) {
addError(MY_TYPE_NAME + " does not support keeping Closure annotation members.", annotation); |
<<<<<<<
private List<MethodNode> findDGMMethodsByNameAndArguments(final ClassNode receiver, final String name, final ClassNode[] args, final List<MethodNode> methods) {
final List<MethodNode> chosen;
methods.addAll(findDGMMethodsForClassNode(receiver, name));
chosen = chooseBestMethod(receiver, methods, args);
return chosen;
}
/**
* Given a list of candidate methods, returns the one which best matches the argument types
*
* @param receiver
* @param methods candidate methods
* @param args argument types
* @return the list of methods which best matches the argument types. It is still possible that multiple
* methods match the argument types.
*/
private List<MethodNode> chooseBestMethod(final ClassNode receiver, Collection<MethodNode> methods, ClassNode... args) {
if (methods.isEmpty()) return Collections.emptyList();
List<MethodNode> bestChoices = new LinkedList<MethodNode>();
int bestDist = Integer.MAX_VALUE;
for (MethodNode m : methods) {
// todo : corner case
/*
class B extends A {}
Animal foo(A o) {...}
Person foo(B i){...}
B a = new B()
Person p = foo(b)
*/
Parameter[] params = parameterizeArguments(receiver, m);
if (params.length == args.length) {
int allPMatch = allParametersAndArgumentsMatch(params, args);
int lastArgMatch = isVargs(params)?lastArgMatchesVarg(params, args):-1;
if (lastArgMatch>=0) lastArgMatch++; // ensure exact matches are preferred over vargs
int dist = allPMatch>=0?Math.max(allPMatch, lastArgMatch):lastArgMatch;
if (dist>=0 && !receiver.equals(m.getDeclaringClass())) dist+=getDistance(receiver, m.getDeclaringClass());
if (dist>=0 && dist<bestDist) {
bestChoices.clear();
bestChoices.add(m);
bestDist = dist;
} else if (dist>=0 && dist==bestDist) {
bestChoices.add(m);
}
} else if (isVargs(params)) {
boolean firstParamMatches = true;
// check first parameters
if (args.length > 0) {
Parameter[] firstParams = new Parameter[params.length - 1];
System.arraycopy(params, 0, firstParams, 0, firstParams.length);
firstParamMatches = allParametersAndArgumentsMatch(firstParams, args) >= 0;
}
if (firstParamMatches) {
// there are three case for vargs
// (1) varg part is left out
if (params.length == args.length + 1) {
if (bestDist > 1) {
bestChoices.clear();
bestChoices.add(m);
bestDist = 1;
}
} else {
// (2) last argument is put in the vargs array
// that case is handled above already
// (3) there is more than one argument for the vargs array
int dist = excessArgumentsMatchesVargsParameter(params, args);
if (dist >= 0 && !receiver.equals(m.getDeclaringClass())) dist++;
// varargs methods must not be preferred to methods without varargs
// for example :
// int sum(int x) should be preferred to int sum(int x, int... y)
dist++;
if (params.length < args.length && dist >= 0) {
if (dist >= 0 && dist < bestDist) {
bestChoices.clear();
bestChoices.add(m);
bestDist = dist;
} else if (dist >= 0 && dist == bestDist) {
bestChoices.add(m);
}
}
}
}
}
}
return bestChoices;
}
private int getDistance(final ClassNode receiver, final ClassNode compare) {
if (receiver.equals(compare)) return 0;
ClassNode superClass = compare.getSuperClass();
if (superClass ==null) return 1;
return 1+getDistance(receiver, superClass);
}
/**
* Given a receiver and a method node, parameterize the method arguments using
* available generic type information.
* @param receiver
* @param m
* @return
*/
private Parameter[] parameterizeArguments(final ClassNode receiver, final MethodNode m) {
GenericsType[] redirectReceiverTypes = receiver.redirect().getGenericsTypes();
if (redirectReceiverTypes==null) {
// we must perform an additional check for methods like Collections#sort which define generics
// at the method level
redirectReceiverTypes = m.getGenericsTypes();
}
if (redirectReceiverTypes==null) return m.getParameters();
Parameter[] methodParameters = m.getParameters();
Parameter[] params = new Parameter[methodParameters.length];
GenericsType[] receiverParameterizedTypes = receiver.getGenericsTypes();
if (receiverParameterizedTypes==null) {
receiverParameterizedTypes = redirectReceiverTypes;
}
for (int i = 0; i < methodParameters.length; i++) {
Parameter methodParameter = methodParameters[i];
ClassNode paramType = methodParameter.getType();
if (paramType.isUsingGenerics()) {
GenericsType[] alignmentTypes = paramType.getGenericsTypes();
GenericsType[] genericsTypes = GenericsUtils.alignGenericTypes(redirectReceiverTypes, receiverParameterizedTypes, alignmentTypes);
if (genericsTypes.length==1) {
ClassNode parameterizedCN;
if (paramType.equals(OBJECT_TYPE)) {
parameterizedCN = genericsTypes[0].getType();
} else {
parameterizedCN= paramType.getPlainNodeReference();
parameterizedCN.setGenericsTypes(genericsTypes);
}
params[i] = new Parameter(
parameterizedCN,
methodParameter.getName()
);
} else {
params[i] = methodParameter;
}
} else {
params[i] = methodParameter;
}
}
return params;
}
=======
>>>>>>> |
<<<<<<<
if (fullName.equals("walrus"))
return new ResolverResult(BlockEnum.WALRUS.getInternalName(), 0);
if (fullName.equals("wirelessFluidTerminal"))
return new ResolverResult(ItemEnum.FLUIDWIRELESSTERMINAL.getInternalName(), 0);
=======
if (fullName.equals("fluidCrafter"))
return new ResolverResult(BlockEnum.CERTUSTANK.getInternalName(), 0);
if (fullName.equals("wirelessFluidTerminal")){
return new ResolverResult(ItemEnum.FLUIDWIRELESSTERMINAL.getInternalName(), 0);
}if (fullName.equals("walrus")){
return new ResolverResult(BlockEnum.WALRUS.getInternalName(), 0);
}
>>>>>>>
if (fullName.equals("fluidCrafter"))
return new ResolverResult(BlockEnum.CERTUSTANK.getInternalName(), 0);
if (fullName.equals("wirelessFluidTerminal"))
return new ResolverResult(ItemEnum.FLUIDWIRELESSTERMINAL.getInternalName(), 0);
if (fullName.equals("walrus"))
return new ResolverResult(BlockEnum.WALRUS.getInternalName(), 0); |
<<<<<<<
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
=======
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
>>>>>>>
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
<<<<<<<
@Test
public void includeDirectoryKeyInInputShouldChangeIncludeDirectory() throws IOException {
// given
File jekyll = new File(new File("").getAbsolutePath(), "src/test/jekyll");
File index = new File(jekyll, "index_without_quotes.html");
Template template = Template.parse(index, new ParseSettings.Builder().withFlavor(Flavor.JEKYLL).build());
Map<String, Object> data = new HashMap<String, Object>();
data.put(Include.INCLUDES_DIRECTORY_KEY, new File(new File("").getAbsolutePath(), "src/test/jekyll/alternative_includes"));
// when
String result = template.render(data);
// then
assertTrue(result.contains("ALTERNATIVE"));
}
@Test
public void includeDirectoryKeyStringInInputShouldChangeIncludeDirectory() throws IOException {
// given
File jekyll = new File(new File("").getAbsolutePath(), "src/test/jekyll");
File index = new File(jekyll, "index_without_quotes.html");
Template template = Template.parse(index, new ParseSettings.Builder().withFlavor(Flavor.JEKYLL).build());
Map<String, Object> data = new HashMap<String, Object>();
data.put(Include.INCLUDES_DIRECTORY_KEY, "alternative_includes");
// when
String result = template.render(data);
// then
assertTrue(result.contains("ALTERNATIVE"));
}
=======
@Test
public void errorInIncludeCauseMissingIncludeWithDefaultRendering() throws IOException {
//given
File jekyll = new File(new File("").getAbsolutePath(), "src/test/jekyll");
File index = new File(jekyll, "index_with_errored_include.html");
Template template = Template.parse(index, Flavor.JEKYLL);
// when
String result = template.render();
// them
assertFalse(result.contains("THE_ERROR"));
}
@Test(expected = RuntimeException.class)
public void errorInIncludeCauseMissingIncludeWithCustomRendering() throws IOException {
//given
File jekyll = new File(new File("").getAbsolutePath(), "src/test/jekyll");
File index = new File(jekyll, "index_with_errored_include.html");
ParseSettings parseSettings = new ParseSettings.Builder().withFlavor(Flavor.JEKYLL).build();
RenderSettings renderSettings = new RenderSettings.Builder().withShowExceptionsFromInclude(true).build();
Template template = Template.parse(index, parseSettings).withRenderSettings(renderSettings);
// when
template.render();
// them
fail();
}
@Test
public void errorInIncludeCauseMissingIncludeWithCustomRenderingAndFixedError() throws IOException {
//given
File jekyll = new File(new File("").getAbsolutePath(), "src/test/jekyll");
File index = new File(jekyll, "index_with_errored_include.html");
ParseSettings parseSettings = new ParseSettings.Builder().withFlavor(Flavor.JEKYLL).build();
RenderSettings renderSettings = new RenderSettings.Builder().withShowExceptionsFromInclude(true).build();
Template template = Template.parse(index, parseSettings).withRenderSettings(renderSettings);
Filter.registerFilter(new Filter("normalize_whitespace") {
});
// when
String result = template.render();
// them
assertTrue(result.contains("THE_ERROR"));
}
public void includeDirectoryKeyInInputShouldChangeIncludeDirectory() throws IOException {
// given
File jekyll = new File(new File("").getAbsolutePath(), "src/test/jekyll");
File index = new File(jekyll, "index_without_quotes.html");
Template template = Template.parse(index, new ParseSettings.Builder().withFlavor(Flavor.JEKYLL).build());
Map<String, Object> data = new HashMap<String, Object>();
data.put(Include.INCLUDES_DIRECTORY_KEY, new File(new File("").getAbsolutePath(), "src/test/jekyll/alternative_includes"));
// when
String result = template.render(data);
// then
assertTrue(result.contains("ALTERNATIVE"));
}
>>>>>>>
@Test
public void includeDirectoryKeyInInputShouldChangeIncludeDirectory() throws IOException {
// given
File jekyll = new File(new File("").getAbsolutePath(), "src/test/jekyll");
File index = new File(jekyll, "index_without_quotes.html");
Template template = Template.parse(index, new ParseSettings.Builder().withFlavor(Flavor.JEKYLL).build());
Map<String, Object> data = new HashMap<String, Object>();
data.put(Include.INCLUDES_DIRECTORY_KEY, new File(new File("").getAbsolutePath(), "src/test/jekyll/alternative_includes"));
// when
String result = template.render(data);
// then
assertTrue(result.contains("ALTERNATIVE"));
}
@Test
public void includeDirectoryKeyStringInInputShouldChangeIncludeDirectory() throws IOException {
//given
File jekyll = new File(new File("").getAbsolutePath(), "src/test/jekyll");
File index = new File(jekyll, "index_with_errored_include.html");
Template template = Template.parse(index, Flavor.JEKYLL);
// when
String result = template.render();
// them
assertFalse(result.contains("THE_ERROR"));
}
@Test(expected = RuntimeException.class)
public void errorInIncludeCauseMissingIncludeWithCustomRendering() throws IOException {
//given
File jekyll = new File(new File("").getAbsolutePath(), "src/test/jekyll");
File index = new File(jekyll, "index_with_errored_include.html");
ParseSettings parseSettings = new ParseSettings.Builder().withFlavor(Flavor.JEKYLL).build();
RenderSettings renderSettings = new RenderSettings.Builder().withShowExceptionsFromInclude(true).build();
Template template = Template.parse(index, parseSettings).withRenderSettings(renderSettings);
// when
template.render();
// them
fail();
}
@Test
public void errorInIncludeCauseMissingIncludeWithCustomRenderingAndFixedError() throws IOException {
//given
File jekyll = new File(new File("").getAbsolutePath(), "src/test/jekyll");
File index = new File(jekyll, "index_with_errored_include.html");
ParseSettings parseSettings = new ParseSettings.Builder().withFlavor(Flavor.JEKYLL).build();
RenderSettings renderSettings = new RenderSettings.Builder().withShowExceptionsFromInclude(true).build();
Template template = Template.parse(index, parseSettings).withRenderSettings(renderSettings);
Filter.registerFilter(new Filter("normalize_whitespace") {
});
// when
String result = template.render();
// them
assertTrue(result.contains("THE_ERROR"));
}
public void includeDirectoryKeyInInputShouldChangeIncludeDirectory() throws IOException {
// given
File jekyll = new File(new File("").getAbsolutePath(), "src/test/jekyll");
File index = new File(jekyll, "index_without_quotes.html");
Template template = Template.parse(index, new ParseSettings.Builder().withFlavor(Flavor.JEKYLL).build());
Map<String, Object> data = new HashMap<String, Object>();
data.put(Include.INCLUDES_DIRECTORY_KEY, "alternative_includes");
// when
String result = template.render(data);
// then
assertTrue(result.contains("ALTERNATIVE"));
} |
<<<<<<<
import org.openqa.selenium.By;
=======
>>>>>>>
<<<<<<<
* Waits unconditionally for explicit amount of time. The method should be used only as a last resort. In most
* cases you should wait for some condition, e.g. visibility of particular element on the page.
*
* @param amount amount of time
* @param timeUnit unit of time
* @return {@code this} to allow chaining method invocations
*/
public FluentWait explicitlyFor(long amount, TimeUnit timeUnit) {
try {
timeUnit.sleep(amount);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
return this;
}
/**
* Return the current driver
=======
* Wait until the given condition is true.
>>>>>>>
* Waits unconditionally for explicit amount of time. The method should be used only as a last resort. In most
* cases you should wait for some condition, e.g. visibility of particular element on the page.
*
* @param amount amount of time
* @param timeUnit unit of time
* @return {@code this} to allow chaining method invocations
*/
public FluentWait explicitlyFor(long amount, TimeUnit timeUnit) {
try {
timeUnit.sleep(amount);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
return this;
}
/**
* Wait until the given condition is true. |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
import net.minecraft.world.biome.BiomeGenBase;
=======
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
>>>>>>>
<<<<<<<
@SubscribeEvent
public void populate(PopulateChunkEvent.Post event) {
boolean doGen = TerrainGen.populate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkZ, event.hasVillageGenerated,
PopulateChunkEvent.Populate.EventType.CUSTOM);
if (!doGen) {
event.setResult(Result.ALLOW);
return;
}
// shift to world coordinates
int worldX = event.chunkX << 4;
int worldZ = event.chunkZ << 4;
doPopulate(event.world, event.rand, worldX, worldZ);
}
private void doPopulate(World world, Random random, int x, int z) {
// A spring will be generated every 40th chunk.
if (random.nextFloat() > 0.025f) {
return;
}
// Do not generate water in the End or the Nether
BiomeGenBase biomegenbase = world.getWorldChunkManager().getBiomeGenerator(new BlockPos(x, 10, z));
if (biomegenbase.biomeID == BiomeGenBase.sky.biomeID || biomegenbase.biomeID == BiomeGenBase.hell.biomeID) {
return;
}
int posX = x + random.nextInt(16);
int posZ = z + random.nextInt(16);
for (int i = 0; i < 5; i++) {
BlockPos pos = new BlockPos(posX, i, posZ);
Block candidate = world.getBlockState(pos).getBlock();
if (candidate != Blocks.bedrock) {
continue;
}
world.setBlockState(pos.up(), BuildCraftCore.springBlock.getDefaultState());
for (int j = i + 2; j < world.getActualHeight() - 10; j++) {
BlockPos above = pos.up(j);
if (!boreToSurface(world, above)) {
if (world.isAirBlock(above)) {
world.setBlockState(above, Blocks.water.getDefaultState());
}
break;
}
}
break;
}
}
private boolean boreToSurface(World world, BlockPos pos) {
if (world.isAirBlock(pos)) {
return false;
}
Block existing = world.getBlockState(pos).getBlock();
if (existing != Blocks.stone && existing != Blocks.dirt && existing != Blocks.gravel && existing != Blocks.grass) {
return false;
}
world.setBlockState(pos, Blocks.water.getDefaultState());
return true;
}
=======
@SubscribeEvent
public void populate(PopulateChunkEvent.Post event) {
boolean doGen = TerrainGen.populate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkZ, event.hasVillageGenerated, PopulateChunkEvent.Populate.EventType.CUSTOM);
if (!doGen || !BlockSpring.EnumSpring.WATER.canGen) {
event.setResult(Result.ALLOW);
return;
}
// shift to world coordinates
int worldX = event.chunkX << 4;
int worldZ = event.chunkZ << 4;
doPopulate(event.world, event.rand, worldX, worldZ);
}
private void doPopulate(World world, Random random, int x, int z) {
int dimId = world.provider.dimensionId;
// No water springs will generate in the Nether or End.
if (dimId == -1 || dimId == 1) {
return;
}
// A spring will be generated every 40th chunk.
if (random.nextFloat() > 0.025f) {
return;
}
int posX = x + random.nextInt(16);
int posZ = z + random.nextInt(16);
for (int i = 0; i < 5; i++) {
Block candidate = world.getBlock(posX, i, posZ);
if (candidate != Blocks.bedrock) {
continue;
}
// Handle flat bedrock maps
int y = i > 0 ? i : i - 1;
world.setBlock(posX, y + 1, posZ, BuildCraftCore.springBlock);
for (int j = y + 2; j < world.getActualHeight(); j++) {
if (world.isAirBlock(posX, j, posZ)) {
break;
} else {
world.setBlock(posX, j, posZ, Blocks.water);
}
}
break;
}
}
>>>>>>>
@SubscribeEvent
public void populate(PopulateChunkEvent.Post event) {
boolean doGen = TerrainGen.populate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkZ, event.hasVillageGenerated,
PopulateChunkEvent.Populate.EventType.CUSTOM);
if (!doGen || !EnumSpring.WATER.canGen) {
event.setResult(Result.ALLOW);
return;
}
// shift to world coordinates
int worldX = event.chunkX << 4;
int worldZ = event.chunkZ << 4;
doPopulate(event.world, event.rand, worldX, worldZ);
}
private void doPopulate(World world, Random random, int x, int z) {
int dimId = world.provider.getDimensionId();
// No water springs will generate in the Nether or End.
if (dimId == -1 || dimId == 1) {
return;
}
// A spring will be generated every 40th chunk.
if (random.nextFloat() > 0.025f) {
return;
}
int posX = x + random.nextInt(16);
int posZ = z + random.nextInt(16);
for (int i = 0; i < 5; i++) {
BlockPos pos = new BlockPos(posX, i, posZ);
Block candidate = world.getBlockState(pos).getBlock();
if (candidate != Blocks.bedrock) {
continue;
}
// Handle flat bedrock maps
int y = i > 0 ? i : i - 1;
IBlockState springState = BuildCraftCore.springBlock.getDefaultState();
springState = springState.withProperty(BlockBuildCraftBase.SPRING_TYPE, EnumSpring.WATER);
world.setBlockState(new BlockPos(posX, y, posZ), springState);
for (int j = y + 2; j < world.getActualHeight(); j++) {
if (world.isAirBlock(new BlockPos(posX, j, posZ))) {
break;
} else {
world.setBlockState(new BlockPos(posX, j, posZ), Blocks.water.getDefaultState());
}
}
break;
}
} |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
<<<<<<<
=======
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.common.util.ForgeDirection;
>>>>>>>
<<<<<<<
private static final EnumMap<EnumFacing, AxisAlignedBB[]> boxesMap = Maps.newEnumMap(EnumFacing.class);
static {
for (EnumFacing face : EnumFacing.values()) {
AxisAlignedBB[] array = new AxisAlignedBB[2];
Vec3 min = Utils.VEC_ZERO;
Vec3 max = Utils.VEC_ONE;
if (face.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE) {
max = max.add(Utils.convert(face, -0.75));
} else {
min = min.add(Utils.convert(face, 0.75));
}
array[0] = new AxisAlignedBB(min.xCoord, min.yCoord, min.zCoord, max.xCoord, max.yCoord, max.zCoord);
min = Utils.convertExcept(face, 5 / 16d).add(Utils.convert(face, 3 / 16d));
max = Utils.convertExcept(face, 11 / 16d).add(Utils.convert(face, 13 / 16d));
array[1] = new AxisAlignedBB(min.xCoord, min.yCoord, min.zCoord, max.xCoord, max.yCoord, max.zCoord);
boxesMap.put(face, array);
}
}
public BlockLaser() {
super(Material.iron, FACING_6_PROP);
setHardness(10F);
setCreativeTab(BCCreativeTab.get("main"));
setDefaultState(getDefaultState().withProperty(FACING_6_PROP, EnumFacing.UP));
}
@Override
public AxisAlignedBB[] getBoxes(IBlockAccess access, BlockPos pos, IBlockState state) {
return boxesMap.get(FACING_6_PROP.getValue(state));
}
@Override
public double getExpansion() {
return 0.0075;
}
@Override
public double getBreathingCoefficent() {
return 0.725;
}
// @Override
// public MovingObjectPosition collisionRayTrace(World wrd, BlockPos pos, Vec3 origin, Vec3 direction) {
// AxisAlignedBB[] aabbs = getBoxes(wrd, pos, wrd.getBlockState(pos));
// MovingObjectPosition closest = null;
// for (AxisAlignedBB aabb : aabbs) {
// MovingObjectPosition mop = aabb.offset(pos.getX(), pos.getY(), pos.getZ()).calculateIntercept(origin, direction);
// if (mop != null) {
// if (closest != null && mop.hitVec.distanceTo(origin) < closest.hitVec.distanceTo(origin)) {
// closest = mop;
// } else {
// closest = mop;
// }
// }
// }
// if (closest != null) {
// closest.hitVec = Utils.convertMiddle(pos);
//
// // closest.blockX = x;
// // closest.blockY = y;
// // closest.blockZ = z;
// }
// return closest;
// }
@Override
@SuppressWarnings("unchecked")
public void addCollisionBoxesToList(World wrd, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity ent) {
AxisAlignedBB[] aabbs = getBoxes(wrd, pos, state);
for (AxisAlignedBB aabb : aabbs) {
AxisAlignedBB aabbTmp = aabb.offset(pos.getX(), pos.getY(), pos.getZ());
if (mask.intersectsWith(aabbTmp)) {
list.add(aabbTmp);
}
}
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean isFullCube() {
return false;
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileLaser();
}
@Override
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta,
EntityLivingBase placer) {
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer);
}
// @Override
// public int onBlockPlaced(World world, BlockPos pos, EnumFacing face, float par6, float par7, float par8, int
// meta) {
// super.onBlockPlaced(world, pos, side, par6, par7, par8, meta);
//
// int retMeta = meta;
//
// if (side <= 6) {
// retMeta = side;
// }
//
// return retMeta;
// }
@Override
public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side) {
return false;
}
=======
private static final AxisAlignedBB[][] boxes = {
{AxisAlignedBB.getBoundingBox(0.0, 0.75, 0.0, 1.0, 1.0, 1.0), AxisAlignedBB.getBoundingBox(0.3125, 0.1875, 0.3125, 0.6875, 0.75, 0.6875)}, // -Y
{AxisAlignedBB.getBoundingBox(0.0, 0.0, 0.0, 1.0, 0.25, 1.0), AxisAlignedBB.getBoundingBox(0.3125, 0.25, 0.3125, 0.6875, 0.8125, 0.6875)}, // +Y
{AxisAlignedBB.getBoundingBox(0.0, 0.0, 0.75, 1.0, 1.0, 1.0), AxisAlignedBB.getBoundingBox(0.3125, 0.3125, 0.1875, 0.6875, 0.6875, 0.75)}, // -Z
{AxisAlignedBB.getBoundingBox(0.0, 0.0, 0.0, 1.0, 1.0, 0.25), AxisAlignedBB.getBoundingBox(0.3125, 0.3125, 0.25, 0.6875, 0.6875, 0.8125)}, // +Z
{AxisAlignedBB.getBoundingBox(0.75, 0.0, 0.0, 1.0, 1.0, 1.0), AxisAlignedBB.getBoundingBox(0.1875, 0.3125, 0.3125, 0.75, 0.6875, 0.6875)}, // -X
{AxisAlignedBB.getBoundingBox(0.0, 0.0, 0.0, 0.25, 1.0, 1.0), AxisAlignedBB.getBoundingBox(0.25, 0.3125, 0.3125, 0.8125, 0.6875, 0.6875)} // +X
};
public BlockLaser() {
super(Material.iron);
setHardness(10F);
setCreativeTab(BCCreativeTab.get("main"));
}
@Override
public AxisAlignedBB[] getBoxes(World wrd, int x, int y, int z, EntityPlayer player) {
return boxes[wrd.getBlockMetadata(x, y, z)];
}
@Override
public double getExpansion() {
return 0.0075;
}
@Override
public MovingObjectPosition collisionRayTrace(World wrd, int x, int y, int z, Vec3 origin, Vec3 direction) {
AxisAlignedBB[] aabbs = boxes[wrd.getBlockMetadata(x, y, z)];
MovingObjectPosition closest = null;
for (AxisAlignedBB aabb : aabbs) {
MovingObjectPosition mop = aabb.getOffsetBoundingBox(x, y, z).calculateIntercept(origin, direction);
if (mop != null) {
if (closest != null && mop.hitVec.distanceTo(origin) < closest.hitVec.distanceTo(origin)) {
closest = mop;
} else {
closest = mop;
}
}
}
if (closest != null) {
closest.blockX = x;
closest.blockY = y;
closest.blockZ = z;
}
return closest;
}
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
public void addCollisionBoxesToList(World wrd, int x, int y, int z, AxisAlignedBB mask, List list, Entity ent) {
AxisAlignedBB[] aabbs = boxes[wrd.getBlockMetadata(x, y, z)];
for (AxisAlignedBB aabb : aabbs) {
AxisAlignedBB aabbTmp = aabb.getOffsetBoundingBox(x, y, z);
if (mask.intersectsWith(aabbTmp)) {
list.add(aabbTmp);
}
}
}
@Override
public int getRenderType() {
return SiliconProxy.laserBlockModel;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileLaser();
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess access, int x, int y, int z, int side) {
return getIcon(side, access.getBlockMetadata(x, y, z));
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int i, int j) {
if (i == (j ^ 1)) {
return icons[0][0];
} else if (i == j) {
return icons[0][1];
} else {
return icons[0][2];
}
}
@Override
public int onBlockPlaced(World world, int x, int y, int z, int side, float par6, float par7, float par8, int meta) {
super.onBlockPlaced(world, x, y, z, side, par6, par7, par8, meta);
int retMeta = meta;
if (side <= 6) {
retMeta = side;
}
return retMeta;
}
@Override
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
return false;
}
@Override
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
return true;
}
>>>>>>>
private static final EnumMap<EnumFacing, AxisAlignedBB[]> boxesMap = Maps.newEnumMap(EnumFacing.class);
static {
// FIXME: THIS IS WRONG FOR ALL NEGATIVE DIRECTIONS
for (EnumFacing face : EnumFacing.values()) {
AxisAlignedBB[] array = new AxisAlignedBB[2];
Vec3 min = Utils.VEC_ZERO;
Vec3 max = Utils.VEC_ONE;
if (face.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE) {
max = max.add(Utils.convert(face, -0.75));
} else {
min = min.add(Utils.convert(face, 0.75));
}
array[0] = new AxisAlignedBB(min.xCoord, min.yCoord, min.zCoord, max.xCoord, max.yCoord, max.zCoord);
min = Utils.convertExcept(face, 5 / 16d).add(Utils.convert(face, 3 / 16d));
max = Utils.convertExcept(face, 11 / 16d).add(Utils.convert(face, 13 / 16d));
array[1] = new AxisAlignedBB(min.xCoord, min.yCoord, min.zCoord, max.xCoord, max.yCoord, max.zCoord);
boxesMap.put(face, array);
}
}
public BlockLaser() {
super(Material.iron, FACING_6_PROP);
setHardness(10F);
setCreativeTab(BCCreativeTab.get("main"));
setDefaultState(getDefaultState().withProperty(FACING_6_PROP, EnumFacing.UP));
}
@Override
public AxisAlignedBB[] getBoxes(IBlockAccess access, BlockPos pos, IBlockState state) {
return boxesMap.get(FACING_6_PROP.getValue(state));
}
@Override
public double getExpansion() {
return 0.0075;
}
@Override
public double getBreathingCoefficent() {
return 0.725;
}
// @Override
// public MovingObjectPosition collisionRayTrace(World wrd, BlockPos pos, Vec3 origin, Vec3 direction) {
// AxisAlignedBB[] aabbs = getBoxes(wrd, pos, wrd.getBlockState(pos));
// MovingObjectPosition closest = null;
// for (AxisAlignedBB aabb : aabbs) {
// MovingObjectPosition mop = aabb.offset(pos.getX(), pos.getY(), pos.getZ()).calculateIntercept(origin, direction);
// if (mop != null) {
// if (closest != null && mop.hitVec.distanceTo(origin) < closest.hitVec.distanceTo(origin)) {
// closest = mop;
// } else {
// closest = mop;
// }
// }
// }
// if (closest != null) {
// closest.hitVec = Utils.convertMiddle(pos);
//
// // closest.blockX = x;
// // closest.blockY = y;
// // closest.blockZ = z;
// }
// return closest;
// }
@Override
@SuppressWarnings("unchecked")
public void addCollisionBoxesToList(World wrd, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity ent) {
AxisAlignedBB[] aabbs = getBoxes(wrd, pos, state);
for (AxisAlignedBB aabb : aabbs) {
AxisAlignedBB aabbTmp = aabb.offset(pos.getX(), pos.getY(), pos.getZ());
if (mask.intersectsWith(aabbTmp)) {
list.add(aabbTmp);
}
}
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean isFullCube() {
return false;
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileLaser();
}
@Override
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta,
EntityLivingBase placer) {
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer);
}
// @Override
// public int onBlockPlaced(World world, BlockPos pos, EnumFacing face, float par6, float par7, float par8, int
// meta) {
// super.onBlockPlaced(world, pos, side, par6, par7, par8, meta);
//
// int retMeta = meta;
//
// if (side <= 6) {
// retMeta = side;
// }
//
// return retMeta;
// }
@Override
public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side) {
return false;
} |
<<<<<<<
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
=======
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
>>>>>>>
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
<<<<<<<
@Test
public void errorInIncludeCauseMissingIncludeWithDefaultRendering() throws IOException {
//given
File jekyll = new File(new File("").getAbsolutePath(), "src/test/jekyll");
File index = new File(jekyll, "index_with_errored_include.html");
Template template = Template.parse(index, Flavor.JEKYLL);
// when
String result = template.render();
// them
assertFalse(result.contains("THE_ERROR"));
}
@Test(expected = RuntimeException.class)
public void errorInIncludeCauseMissingIncludeWithCustomRendering() throws IOException {
//given
File jekyll = new File(new File("").getAbsolutePath(), "src/test/jekyll");
File index = new File(jekyll, "index_with_errored_include.html");
ParseSettings parseSettings = new ParseSettings.Builder().withFlavor(Flavor.JEKYLL).build();
RenderSettings renderSettings = new RenderSettings.Builder().withShowExceptionsFromInclude(true).build();
Template template = Template.parse(index, parseSettings).withRenderSettings(renderSettings);
// when
template.render();
// them
fail();
}
@Test
public void errorInIncludeCauseMissingIncludeWithCustomRenderingAndFixedError() throws IOException {
//given
File jekyll = new File(new File("").getAbsolutePath(), "src/test/jekyll");
File index = new File(jekyll, "index_with_errored_include.html");
ParseSettings parseSettings = new ParseSettings.Builder().withFlavor(Flavor.JEKYLL).build();
RenderSettings renderSettings = new RenderSettings.Builder().withShowExceptionsFromInclude(true).build();
Template template = Template.parse(index, parseSettings).withRenderSettings(renderSettings);
Filter.registerFilter(new Filter("normalize_whitespace") {
});
// when
String result = template.render();
// them
assertTrue(result.contains("THE_ERROR"));
}
=======
@Test
public void includeDirectoryKeyInInputShouldChangeIncludeDirectory() throws IOException {
// given
File jekyll = new File(new File("").getAbsolutePath(), "src/test/jekyll");
File index = new File(jekyll, "index_without_quotes.html");
Template template = Template.parse(index, new ParseSettings.Builder().withFlavor(Flavor.JEKYLL).build());
Map<String, Object> data = new HashMap<String, Object>();
data.put(Include.INCLUDES_DIRECTORY_KEY, new File(new File("").getAbsolutePath(), "src/test/jekyll/alternative_includes"));
// when
String result = template.render(data);
// then
assertTrue(result.contains("ALTERNATIVE"));
}
>>>>>>>
@Test
public void errorInIncludeCauseMissingIncludeWithDefaultRendering() throws IOException {
//given
File jekyll = new File(new File("").getAbsolutePath(), "src/test/jekyll");
File index = new File(jekyll, "index_with_errored_include.html");
Template template = Template.parse(index, Flavor.JEKYLL);
// when
String result = template.render();
// them
assertFalse(result.contains("THE_ERROR"));
}
@Test(expected = RuntimeException.class)
public void errorInIncludeCauseMissingIncludeWithCustomRendering() throws IOException {
//given
File jekyll = new File(new File("").getAbsolutePath(), "src/test/jekyll");
File index = new File(jekyll, "index_with_errored_include.html");
ParseSettings parseSettings = new ParseSettings.Builder().withFlavor(Flavor.JEKYLL).build();
RenderSettings renderSettings = new RenderSettings.Builder().withShowExceptionsFromInclude(true).build();
Template template = Template.parse(index, parseSettings).withRenderSettings(renderSettings);
// when
template.render();
// them
fail();
}
@Test
public void errorInIncludeCauseMissingIncludeWithCustomRenderingAndFixedError() throws IOException {
//given
File jekyll = new File(new File("").getAbsolutePath(), "src/test/jekyll");
File index = new File(jekyll, "index_with_errored_include.html");
ParseSettings parseSettings = new ParseSettings.Builder().withFlavor(Flavor.JEKYLL).build();
RenderSettings renderSettings = new RenderSettings.Builder().withShowExceptionsFromInclude(true).build();
Template template = Template.parse(index, parseSettings).withRenderSettings(renderSettings);
Filter.registerFilter(new Filter("normalize_whitespace") {
});
// when
String result = template.render();
// them
assertTrue(result.contains("THE_ERROR"));
}
public void includeDirectoryKeyInInputShouldChangeIncludeDirectory() throws IOException {
// given
File jekyll = new File(new File("").getAbsolutePath(), "src/test/jekyll");
File index = new File(jekyll, "index_without_quotes.html");
Template template = Template.parse(index, new ParseSettings.Builder().withFlavor(Flavor.JEKYLL).build());
Map<String, Object> data = new HashMap<String, Object>();
data.put(Include.INCLUDES_DIRECTORY_KEY, new File(new File("").getAbsolutePath(), "src/test/jekyll/alternative_includes"));
// when
String result = template.render(data);
// then
assertTrue(result.contains("ALTERNATIVE"));
} |
<<<<<<<
if (current == null || current.getCount() < min || max < 1 || max < min) {
=======
if (current.isEmpty() || current.getCount() < min || min > 1 || max < 1 || max < min) {
>>>>>>>
if (current.isEmpty() || current.getCount() < min || min < 1 || max < min) { |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
=======
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
>>>>>>>
<<<<<<<
private GateDefinition() {}
public static String getLocalizedName(GateMaterial material, GateLogic logic) {
if (material == GateMaterial.REDSTONE) {
return StringUtils.localize("gate.name.basic");
} else {
return String.format(StringUtils.localize("gate.name"), StringUtils.localize("gate.material." + material.getTag()), StringUtils.localize(
"gate.logic." + logic.getTag()));
}
}
public static enum GateMaterial {
REDSTONE("gate_interface_1.png", 146, 1, 0, 0, 1),
IRON("gate_interface_2.png", 164, 2, 0, 0, 2),
GOLD("gate_interface_3.png", 200, 4, 1, 0, 3),
DIAMOND("gate_interface_4.png", 200, 8, 1, 0, 4),
EMERALD("gate_interface_5.png", 200, 4, 3, 3, 4),
QUARTZ("gate_interface_6.png", 164, 2, 1, 1, 3);
public static final GateMaterial[] VALUES = values();
public final ResourceLocation guiFile;
public final int guiHeight;
public final int numSlots;
public final int numTriggerParameters;
public final int numActionParameters;
public final int maxWireColor;
@SideOnly(Side.CLIENT)
private TextureAtlasSprite iconBlock;
@SideOnly(Side.CLIENT)
private TextureAtlasSprite iconItem;
private GateMaterial(String guiFile, int guiHeight, int numSlots, int triggerParameterSlots, int actionParameterSlots, int maxWireColor) {
this.guiFile = new ResourceLocation("buildcrafttransport:textures/gui/" + guiFile);
this.guiHeight = guiHeight;
this.numSlots = numSlots;
this.numTriggerParameters = triggerParameterSlots;
this.numActionParameters = actionParameterSlots;
this.maxWireColor = maxWireColor;
}
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIconBlock() {
return iconBlock;
}
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIconItem() {
return iconItem;
}
public String getTag() {
return name().toLowerCase(Locale.ENGLISH);
}
@SideOnly(Side.CLIENT)
public void registerBlockIcon(TextureMap iconRegister) {
if (this != REDSTONE) {
iconBlock = iconRegister.registerSprite(new ResourceLocation("buildcrafttransport:gates/gate_material_" + getTag()));
}
}
@SideOnly(Side.CLIENT)
public void registerItemIcon(TextureMap iconRegister) {
if (this != REDSTONE) {
iconItem = iconRegister.registerSprite(new ResourceLocation("buildcrafttransport:gates/gate_material_" + getTag()));
}
}
public static GateMaterial fromOrdinal(int ordinal) {
if (ordinal < 0 || ordinal >= VALUES.length) {
return REDSTONE;
}
return VALUES[ordinal];
}
}
public static enum GateLogic {
AND,
OR;
public static final GateLogic[] VALUES = values();
@SideOnly(Side.CLIENT)
private TextureAtlasSprite iconLit;
@SideOnly(Side.CLIENT)
private TextureAtlasSprite iconDark;
@SideOnly(Side.CLIENT)
private TextureAtlasSprite iconItem;
@SideOnly(Side.CLIENT)
private TextureAtlasSprite iconGate;
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIconLit() {
return iconLit;
}
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIconDark() {
return iconDark;
}
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getGateIcon() {
return iconGate;
}
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIconItem() {
return iconItem;
}
public String getTag() {
return name().toLowerCase(Locale.ENGLISH);
}
@SideOnly(Side.CLIENT)
public void registerBlockIcon(TextureMap iconRegister) {
String lit = "buildcrafttransport:gates/gate_" + getTag() + "_lit";
String dark = "buildcrafttransport:gates/gate_" + getTag() + "_dark";
String base = "buildcrafttransport:gates/gate_" + getTag();
iconLit = new SpriteBuilder(lit + "_generated").addSprite(base, 0xFE).addSprite(lit, 0xFE).build();
iconDark = new SpriteBuilder(dark + "_generated").addSprite(base, 0xFE).addSprite(dark, 0xFE).build();
iconRegister.setTextureEntry(lit + "_generated", iconLit);
iconRegister.setTextureEntry(dark + "_generated", iconDark);
// iconLit = iconRegister.registerSprite(new ResourceLocation("buildcrafttransport:gates/gate_" + getTag() +
// "_lit"));
// iconDark = iconRegister.registerSprite(new ResourceLocation("buildcrafttransport:gates/gate_" + getTag()
// + "_dark"));
iconGate = iconRegister.registerSprite(new ResourceLocation("buildcrafttransport:gates/gate_" + getTag()));
}
@SideOnly(Side.CLIENT)
public void registerItemIcon(TextureMap iconRegister) {
iconItem = iconRegister.registerSprite(new ResourceLocation("buildcrafttransport:gates/gate_logic_" + getTag()));
}
public static GateLogic fromOrdinal(int ordinal) {
if (ordinal < 0 || ordinal >= VALUES.length) {
return AND;
}
return VALUES[ordinal];
}
}
=======
private GateDefinition() {
}
public static String getLocalizedName(GateMaterial material, GateLogic logic) {
if (material == GateMaterial.REDSTONE) {
return StringUtils.localize("gate.name.basic");
} else {
return String.format(StringUtils.localize("gate.name"), StringUtils.localize("gate.material." + material.getTag()),
StringUtils.localize("gate.logic." + logic.getTag()));
}
}
public enum GateMaterial {
REDSTONE("gate_interface_1.png", 146, 1, 0, 0, 1),
IRON("gate_interface_2.png", 164, 2, 0, 0, 2),
GOLD("gate_interface_3.png", 200, 4, 1, 0, 3),
DIAMOND("gate_interface_4.png", 200, 8, 1, 0, 4),
EMERALD("gate_interface_5.png", 200, 4, 3, 3, 4),
QUARTZ("gate_interface_6.png", 164, 2, 1, 1, 3);
public static final GateMaterial[] VALUES = values();
public final ResourceLocation guiFile;
public final int guiHeight;
public final int numSlots;
public final int numTriggerParameters;
public final int numActionParameters;
public final int maxWireColor;
@SideOnly(Side.CLIENT)
private IIcon iconBlock;
@SideOnly(Side.CLIENT)
private IIcon iconItem;
GateMaterial(String guiFile, int guiHeight, int numSlots, int triggerParameterSlots,
int actionParameterSlots, int maxWireColor) {
this.guiFile = new ResourceLocation("buildcrafttransport:textures/gui/" + guiFile);
this.guiHeight = guiHeight;
this.numSlots = numSlots;
this.numTriggerParameters = triggerParameterSlots;
this.numActionParameters = actionParameterSlots;
this.maxWireColor = maxWireColor;
}
@SideOnly(Side.CLIENT)
public IIcon getIconBlock() {
return iconBlock;
}
@SideOnly(Side.CLIENT)
public IIcon getIconItem() {
return iconItem;
}
public String getTag() {
return name().toLowerCase(Locale.ENGLISH);
}
@SideOnly(Side.CLIENT)
public void registerBlockIcon(IIconRegister iconRegister) {
if (this != REDSTONE) {
iconBlock = iconRegister.registerIcon("buildcrafttransport:gates/gate_material_" + getTag());
}
}
@SideOnly(Side.CLIENT)
public void registerItemIcon(IIconRegister iconRegister) {
if (this != REDSTONE) {
iconItem = iconRegister.registerIcon("buildcrafttransport:gates/gate_material_" + getTag());
}
}
public static GateMaterial fromOrdinal(int ordinal) {
if (ordinal < 0 || ordinal >= VALUES.length) {
return REDSTONE;
}
return VALUES[ordinal];
}
}
public enum GateLogic {
AND, OR;
public static final GateLogic[] VALUES = values();
@SideOnly(Side.CLIENT)
private IIcon iconLit;
@SideOnly(Side.CLIENT)
private IIcon iconDark;
@SideOnly(Side.CLIENT)
private IIcon iconItem;
@SideOnly(Side.CLIENT)
private IIcon iconGate;
@SideOnly(Side.CLIENT)
public IIcon getIconLit() {
return iconLit;
}
@SideOnly(Side.CLIENT)
public IIcon getIconDark() {
return iconDark;
}
@SideOnly(Side.CLIENT)
public IIcon getGateIcon() {
return iconGate;
}
@SideOnly(Side.CLIENT)
public IIcon getIconItem() {
return iconItem;
}
public String getTag() {
return name().toLowerCase(Locale.ENGLISH);
}
@SideOnly(Side.CLIENT)
public void registerBlockIcon(IIconRegister iconRegister) {
iconLit = iconRegister.registerIcon("buildcrafttransport:gates/gate_" + getTag() + "_lit");
iconDark = iconRegister.registerIcon("buildcrafttransport:gates/gate_" + getTag() + "_dark");
iconGate = iconRegister.registerIcon("buildcrafttransport:gates/gate_" + getTag());
}
@SideOnly(Side.CLIENT)
public void registerItemIcon(IIconRegister iconRegister) {
iconItem = iconRegister.registerIcon("buildcrafttransport:gates/gate_logic_" + getTag());
}
public static GateLogic fromOrdinal(int ordinal) {
if (ordinal < 0 || ordinal >= VALUES.length) {
return AND;
}
return VALUES[ordinal];
}
}
>>>>>>>
private GateDefinition() {}
public static String getLocalizedName(GateMaterial material, GateLogic logic) {
if (material == GateMaterial.REDSTONE) {
return StringUtils.localize("gate.name.basic");
} else {
return String.format(StringUtils.localize("gate.name"), StringUtils.localize("gate.material." + material.getTag()), StringUtils.localize(
"gate.logic." + logic.getTag()));
}
}
public enum GateMaterial {
REDSTONE("gate_interface_1.png", 146, 1, 0, 0, 1),
IRON("gate_interface_2.png", 164, 2, 0, 0, 2),
GOLD("gate_interface_3.png", 200, 4, 1, 0, 3),
DIAMOND("gate_interface_4.png", 200, 8, 1, 0, 4),
EMERALD("gate_interface_5.png", 200, 4, 3, 3, 4),
QUARTZ("gate_interface_6.png", 164, 2, 1, 1, 3);
public static final GateMaterial[] VALUES = values();
public final ResourceLocation guiFile;
public final int guiHeight;
public final int numSlots;
public final int numTriggerParameters;
public final int numActionParameters;
public final int maxWireColor;
@SideOnly(Side.CLIENT)
private TextureAtlasSprite iconBlock;
@SideOnly(Side.CLIENT)
private TextureAtlasSprite iconItem;
GateMaterial(String guiFile, int guiHeight, int numSlots, int triggerParameterSlots, int actionParameterSlots, int maxWireColor) {
this.guiFile = new ResourceLocation("buildcrafttransport:textures/gui/" + guiFile);
this.guiHeight = guiHeight;
this.numSlots = numSlots;
this.numTriggerParameters = triggerParameterSlots;
this.numActionParameters = actionParameterSlots;
this.maxWireColor = maxWireColor;
}
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIconBlock() {
return iconBlock;
}
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIconItem() {
return iconItem;
}
public String getTag() {
return name().toLowerCase(Locale.ENGLISH);
}
@SideOnly(Side.CLIENT)
public void registerBlockIcon(TextureMap iconRegister) {
if (this != REDSTONE) {
iconBlock = iconRegister.registerSprite(new ResourceLocation("buildcrafttransport:gates/gate_material_" + getTag()));
}
}
@SideOnly(Side.CLIENT)
public void registerItemIcon(TextureMap iconRegister) {
if (this != REDSTONE) {
iconItem = iconRegister.registerSprite(new ResourceLocation("buildcrafttransport:gates/gate_material_" + getTag()));
}
}
public static GateMaterial fromOrdinal(int ordinal) {
if (ordinal < 0 || ordinal >= VALUES.length) {
return REDSTONE;
}
return VALUES[ordinal];
}
}
public enum GateLogic {
AND,
OR;
public static final GateLogic[] VALUES = values();
@SideOnly(Side.CLIENT)
private TextureAtlasSprite iconLit;
@SideOnly(Side.CLIENT)
private TextureAtlasSprite iconDark;
@SideOnly(Side.CLIENT)
private TextureAtlasSprite iconItem;
@SideOnly(Side.CLIENT)
private TextureAtlasSprite iconGate;
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIconLit() {
return iconLit;
}
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIconDark() {
return iconDark;
}
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getGateIcon() {
return iconGate;
}
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIconItem() {
return iconItem;
}
public String getTag() {
return name().toLowerCase(Locale.ENGLISH);
}
@SideOnly(Side.CLIENT)
public void registerBlockIcon(TextureMap iconRegister) {
String lit = "buildcrafttransport:gates/gate_" + getTag() + "_lit";
String dark = "buildcrafttransport:gates/gate_" + getTag() + "_dark";
String base = "buildcrafttransport:gates/gate_" + getTag();
iconLit = new SpriteBuilder(lit + "_generated").addSprite(base, 0xFE).addSprite(lit, 0xFE).build();
iconDark = new SpriteBuilder(dark + "_generated").addSprite(base, 0xFE).addSprite(dark, 0xFE).build();
iconRegister.setTextureEntry(lit + "_generated", iconLit);
iconRegister.setTextureEntry(dark + "_generated", iconDark);
// iconLit = iconRegister.registerSprite(new ResourceLocation("buildcrafttransport:gates/gate_" + getTag() +
// "_lit"));
// iconDark = iconRegister.registerSprite(new ResourceLocation("buildcrafttransport:gates/gate_" + getTag()
// + "_dark"));
iconGate = iconRegister.registerSprite(new ResourceLocation("buildcrafttransport:gates/gate_" + getTag()));
}
@SideOnly(Side.CLIENT)
public void registerItemIcon(TextureMap iconRegister) {
iconItem = iconRegister.registerSprite(new ResourceLocation("buildcrafttransport:gates/gate_logic_" + getTag()));
}
public static GateLogic fromOrdinal(int ordinal) {
if (ordinal < 0 || ordinal >= VALUES.length) {
return AND;
}
return VALUES[ordinal];
}
} |
<<<<<<<
=======
import buildcraft.core.network.BuildCraftChannelHandler;
import buildcraft.core.network.PacketHandler;
>>>>>>>
import buildcraft.core.network.BuildCraftChannelHandler;
<<<<<<<
=======
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.config.Property;
>>>>>>>
<<<<<<<
(DefaultProps.NET_CHANNEL_NAME + "-SILICON", new PacketHandlerSilicon());
=======
(DefaultProps.NET_CHANNEL_NAME + "-SILICON", new BuildCraftChannelHandler(), new PacketHandlerSilicon());
>>>>>>>
(DefaultProps.NET_CHANNEL_NAME + "-SILICON", new BuildCraftChannelHandler(), new PacketHandlerSilicon()); |
<<<<<<<
if (!BuildCraftCore.NEXTGEN_PREALPHA) {
if (blockRedPlasma != null) {
bucketRedPlasma = new ItemBucketBuildcraft(blockRedPlasma, CreativeTabBuildCraft.TIER_4);
bucketRedPlasma.setUnlocalizedName("bucketRedPlasma").setContainerItem(Items.bucket);
LanguageRegistry.addName(bucketRedPlasma, "Red Plasma Bucket");
CoreProxy.proxy.registerItem(bucketRedPlasma);
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("redplasma", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(bucketRedPlasma), new ItemStack(Items.bucket));
}
}
// TODO: Are these still really necessary? If not, remove the
// BucketHandler class as well.
//BucketHandler.INSTANCE.buckets.put(blockOil, bucketOil);
//BucketHandler.INSTANCE.buckets.put(blockFuel, bucketFuel);
//MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE);
=======
// BucketHandler ensures empty buckets fill with the correct liquid.
BucketHandler.INSTANCE.buckets.put(blockOil, bucketOil);
BucketHandler.INSTANCE.buckets.put(blockFuel, bucketFuel);
MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE);
>>>>>>>
if (!BuildCraftCore.NEXTGEN_PREALPHA) {
if (blockRedPlasma != null) {
bucketRedPlasma = new ItemBucketBuildcraft(blockRedPlasma, CreativeTabBuildCraft.TIER_4);
bucketRedPlasma.setUnlocalizedName("bucketRedPlasma").setContainerItem(Items.bucket);
LanguageRegistry.addName(bucketRedPlasma, "Red Plasma Bucket");
CoreProxy.proxy.registerItem(bucketRedPlasma);
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("redplasma", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(bucketRedPlasma), new ItemStack(Items.bucket));
}
}
// BucketHandler ensures empty buckets fill with the correct liquid.
BucketHandler.INSTANCE.buckets.put(blockOil, bucketOil);
BucketHandler.INSTANCE.buckets.put(blockFuel, bucketFuel);
MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE); |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
=======
import net.minecraft.tileentity.TileEntity;
>>>>>>>
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
<<<<<<<
=======
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.SidedProxy;
>>>>>>>
<<<<<<<
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
=======
>>>>>>>
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.SidedProxy;
<<<<<<<
import buildcraft.core.CompatHooks;
import buildcraft.core.lib.items.ItemBlockBuildCraft;
import buildcraft.core.lib.utils.Utils;
=======
import buildcraft.core.LaserKind;
import buildcraft.core.lib.EntityBlock;
>>>>>>>
<<<<<<<
@SidedProxy(clientSide = "buildcraft.core.proxy.CoreProxyClient", serverSide = "buildcraft.core.proxy.CoreProxy")
public static CoreProxy proxy;
/* BUILDCRAFT PLAYER */
protected static WeakReference<EntityPlayer> buildCraftPlayer = new WeakReference<EntityPlayer>(null);
public String getMinecraftVersion() {
return Loader.instance().getMinecraftModContainer().getVersion();
}
/* INSTANCES */
public Object getClient() {
return null;
}
public World getClientWorld() {
return null;
}
/* ENTITY HANDLING */
public void removeEntity(Entity entity) {
entity.worldObj.removeEntity(entity);
}
/* WRAPPER */
@SuppressWarnings("rawtypes")
public void feedSubBlocks(Block block, CreativeTabs tab, List itemList) {}
public String getItemDisplayName(ItemStack newStack) {
return "";
}
/* GFX */
public void initializeRendering() {}
public void initializeEntityRendering() {}
/* REGISTRATION */
public void registerBlock(Block block) {
registerBlock(block, ItemBlockBuildCraft.class);
}
public void registerBlock(Block block, Class<? extends ItemBlock> item) {
GameRegistry.registerBlock(block, item, block.getUnlocalizedName().replace("tile.", ""));
}
public void registerItem(Item item) {
registerItem(item, item.getUnlocalizedName().replace("item.", ""));
}
public void registerItem(Item item, String overridingName) {
GameRegistry.registerItem(item, overridingName);
}
public void registerTileEntity(Class<? extends TileEntity> clas, String ident) {
GameRegistry.registerTileEntity(CompatHooks.INSTANCE.getTile(clas), ident);
}
public void registerTileEntity(Class<? extends TileEntity> clas, String id, String... alternatives) {
GameRegistry.registerTileEntityWithAlternatives(CompatHooks.INSTANCE.getTile(clas), id, alternatives);
}
public void onCraftingPickup(World world, EntityPlayer player, ItemStack stack) {
stack.onCrafting(world, player, stack.stackSize);
}
@SuppressWarnings("unchecked")
public void addCraftingRecipe(ItemStack result, Object... recipe) {
String name = Utils.getNameForItem(result.getItem());
if (name != null) {
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(result, recipe));
}
}
@SuppressWarnings("unchecked")
public void addShapelessRecipe(ItemStack result, Object... recipe) {
String name = Utils.getNameForItem(result.getItem());
if (name != null) {
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(result, recipe));
}
}
public String playerName() {
return "";
}
private WeakReference<EntityPlayer> createNewPlayer(WorldServer world) {
EntityPlayer player = FakePlayerFactory.get(world, BuildCraftCore.gameProfile);
return new WeakReference<EntityPlayer>(player);
}
private WeakReference<EntityPlayer> createNewPlayer(WorldServer world, BlockPos pos) {
EntityPlayer player = FakePlayerFactory.get(world, BuildCraftCore.gameProfile);
player.posX = pos.getX();
player.posY = pos.getY();
player.posZ = pos.getZ();
return new WeakReference<EntityPlayer>(player);
}
@Override
public final WeakReference<EntityPlayer> getBuildCraftPlayer(WorldServer world) {
if (CoreProxy.buildCraftPlayer.get() == null) {
CoreProxy.buildCraftPlayer = createNewPlayer(world);
} else {
CoreProxy.buildCraftPlayer.get().worldObj = world;
}
return CoreProxy.buildCraftPlayer;
}
public final WeakReference<EntityPlayer> getBuildCraftPlayer(WorldServer world, BlockPos pos) {
if (CoreProxy.buildCraftPlayer.get() == null) {
CoreProxy.buildCraftPlayer = createNewPlayer(world, pos);
} else {
CoreProxy.buildCraftPlayer.get().worldObj = world;
CoreProxy.buildCraftPlayer.get().posX = pos.getX();
CoreProxy.buildCraftPlayer.get().posY = pos.getY();
CoreProxy.buildCraftPlayer.get().posZ = pos.getZ();
}
return CoreProxy.buildCraftPlayer;
}
/** This function returns either the player from the handler if it's on the server, or directly from the minecraft
* instance if it's the client. */
public EntityPlayer getPlayerFromNetHandler(INetHandler handler) {
if (handler instanceof NetHandlerPlayServer) {
return ((NetHandlerPlayServer) handler).playerEntity;
}
return null;
}
=======
@SidedProxy(clientSide = "buildcraft.core.proxy.CoreProxyClient", serverSide = "buildcraft.core.proxy.CoreProxy")
public static CoreProxy proxy;
/* BUILDCRAFT PLAYER */
protected static WeakReference<EntityPlayer> buildCraftPlayer = new WeakReference<EntityPlayer>(null);
public String getMinecraftVersion() {
return Loader.instance().getMinecraftModContainer().getVersion();
}
/* INSTANCES */
public Object getClient() {
return null;
}
public World getClientWorld() {
return null;
}
/* ENTITY HANDLING */
public void removeEntity(Entity entity) {
entity.worldObj.removeEntity(entity);
}
public String getItemDisplayName(ItemStack newStack) {
return "";
}
/* GFX */
public void initializeRendering() {
}
public void initializeEntityRendering() {
}
public void onCraftingPickup(World world, EntityPlayer player, ItemStack stack) {
stack.onCrafting(world, player, stack.stackSize);
}
public String playerName() {
return "";
}
private WeakReference<EntityPlayer> createNewPlayer(WorldServer world) {
EntityPlayer player = FakePlayerFactory.get(world, BuildCraftCore.gameProfile);
return new WeakReference<EntityPlayer>(player);
}
private WeakReference<EntityPlayer> createNewPlayer(WorldServer world, int x, int y, int z) {
EntityPlayer player = FakePlayerFactory.get(world, BuildCraftCore.gameProfile);
player.posX = x;
player.posY = y;
player.posZ = z;
return new WeakReference<EntityPlayer>(player);
}
@Override
public final WeakReference<EntityPlayer> getBuildCraftPlayer(WorldServer world) {
if (CoreProxy.buildCraftPlayer.get() == null) {
CoreProxy.buildCraftPlayer = createNewPlayer(world);
} else {
CoreProxy.buildCraftPlayer.get().worldObj = world;
}
return CoreProxy.buildCraftPlayer;
}
public final WeakReference<EntityPlayer> getBuildCraftPlayer(WorldServer world, int x, int y, int z) {
if (CoreProxy.buildCraftPlayer.get() == null) {
CoreProxy.buildCraftPlayer = createNewPlayer(world, x, y, z);
} else {
CoreProxy.buildCraftPlayer.get().worldObj = world;
CoreProxy.buildCraftPlayer.get().posX = x;
CoreProxy.buildCraftPlayer.get().posY = y;
CoreProxy.buildCraftPlayer.get().posZ = z;
}
return CoreProxy.buildCraftPlayer;
}
public EntityBlock newEntityBlock(World world, double i, double j, double k, double iSize, double jSize, double kSize, LaserKind laserKind) {
return new EntityBlock(world, i, j, k, iSize, jSize, kSize);
}
/**
* This function returns either the player from the handler if it's on the
* server, or directly from the minecraft instance if it's the client.
*/
public EntityPlayer getPlayerFromNetHandler(INetHandler handler) {
if (handler instanceof NetHandlerPlayServer) {
return ((NetHandlerPlayServer) handler).playerEntity;
} else {
return null;
}
}
public TileEntity getServerTile(TileEntity source) {
return source;
}
public EntityPlayer getClientPlayer() {
return null;
}
>>>>>>>
@SidedProxy(clientSide = "buildcraft.core.proxy.CoreProxyClient", serverSide = "buildcraft.core.proxy.CoreProxy")
public static CoreProxy proxy;
/* BUILDCRAFT PLAYER */
protected static WeakReference<EntityPlayer> buildCraftPlayer = new WeakReference<EntityPlayer>(null);
public String getMinecraftVersion() {
return Loader.instance().getMinecraftModContainer().getVersion();
}
/* INSTANCES */
public Object getClient() {
return null;
}
public World getClientWorld() {
return null;
}
/* ENTITY HANDLING */
public void removeEntity(Entity entity) {
entity.worldObj.removeEntity(entity);
}
public String getItemDisplayName(ItemStack newStack) {
return "";
}
/* GFX */
public void initializeRendering() {}
public void initializeEntityRendering() {}
public void onCraftingPickup(World world, EntityPlayer player, ItemStack stack) {
stack.onCrafting(world, player, stack.stackSize);
}
public String playerName() {
return "";
}
private WeakReference<EntityPlayer> createNewPlayer(WorldServer world) {
EntityPlayer player = FakePlayerFactory.get(world, BuildCraftCore.gameProfile);
return new WeakReference<EntityPlayer>(player);
}
private WeakReference<EntityPlayer> createNewPlayer(WorldServer world, BlockPos pos) {
EntityPlayer player = FakePlayerFactory.get(world, BuildCraftCore.gameProfile);
player.posX = pos.getX();
player.posY = pos.getY();
player.posZ = pos.getZ();
return new WeakReference<EntityPlayer>(player);
}
@Override
public final WeakReference<EntityPlayer> getBuildCraftPlayer(WorldServer world) {
if (CoreProxy.buildCraftPlayer.get() == null) {
CoreProxy.buildCraftPlayer = createNewPlayer(world);
} else {
CoreProxy.buildCraftPlayer.get().worldObj = world;
}
return CoreProxy.buildCraftPlayer;
}
public final WeakReference<EntityPlayer> getBuildCraftPlayer(WorldServer world, BlockPos pos) {
if (CoreProxy.buildCraftPlayer.get() == null) {
CoreProxy.buildCraftPlayer = createNewPlayer(world, pos);
} else {
CoreProxy.buildCraftPlayer.get().worldObj = world;
CoreProxy.buildCraftPlayer.get().posX = pos.getX();
CoreProxy.buildCraftPlayer.get().posY = pos.getY();
CoreProxy.buildCraftPlayer.get().posZ = pos.getZ();
}
return CoreProxy.buildCraftPlayer;
}
/** This function returns either the player from the handler if it's on the server, or directly from the minecraft
* instance if it's the client. */
public EntityPlayer getPlayerFromNetHandler(INetHandler handler) {
if (handler instanceof NetHandlerPlayServer) {
return ((NetHandlerPlayServer) handler).playerEntity;
}
return null;
}
public <T extends TileEntity> T getServerTile(T source) {
return source;
}
public EntityPlayer getClientPlayer() {
return null;
}
public void postRegisterBlock(Block block) {}
public void postRegisterItem(Item item) {} |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ |
<<<<<<<
for (EnumFacing dir : event.destinations) {
int sideColor = -1;
=======
for (ForgeDirection dir : event.destinations) {
boolean hasFilter = false;
boolean hasLens = false;
int sideColor = -1;
>>>>>>>
for (EnumFacing dir : event.destinations) {
boolean hasFilter = false;
boolean hasLens = false;
int sideColor = -1;
<<<<<<<
sideColor = ((LensPluggable) pluggable).color;
=======
hasFilter = true;
sideColor = ((LensPluggable) pluggable).color;
>>>>>>>
hasFilter = true;
sideColor = ((LensPluggable) pluggable).color;
<<<<<<<
// (2/2) From the other pipe's outpost
IPipe otherPipe = container.getNeighborPipe(dir);
if (otherPipe != null && otherPipe.getTile() != null) {
IPipeTile otherContainer = otherPipe.getTile();
pluggable = otherContainer.getPipePluggable(dir.getOpposite());
if (pluggable != null && pluggable instanceof LensPluggable && ((LensPluggable) pluggable).isFilter) {
int otherColor = ((LensPluggable) pluggable).color;
if (sideColor >= 0 && otherColor != sideColor) {
=======
// (2/2) From the other pipe's outpost
IPipe otherPipe = container.getNeighborPipe(dir);
if (otherPipe != null && otherPipe.getTile() != null) {
IPipeTile otherContainer = otherPipe.getTile();
pluggable = otherContainer.getPipePluggable(dir.getOpposite());
if (pluggable != null && pluggable instanceof LensPluggable && ((LensPluggable) pluggable).isFilter) {
int otherColor = ((LensPluggable) pluggable).color;
if (hasFilter && otherColor != sideColor) {
>>>>>>>
// (2/2) From the other pipe's outpost
IPipe otherPipe = container.getNeighborPipe(dir);
if (otherPipe != null && otherPipe.getTile() != null) {
IPipeTile otherContainer = otherPipe.getTile();
pluggable = otherContainer.getPipePluggable(dir.getOpposite());
if (pluggable != null && pluggable instanceof LensPluggable && ((LensPluggable) pluggable).isFilter) {
int otherColor = ((LensPluggable) pluggable).color;
if (hasFilter && otherColor != sideColor) {
<<<<<<<
continue;
} else if (sideLensColor >= 0) {
=======
continue;
} else if (hasLens) {
>>>>>>>
continue;
} else if (hasLens) { |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ |
<<<<<<<
=======
import net.minecraftforge.fml.common.registry.GameRegistry;
import buildcraft.api.BCBlocks;
import buildcraft.lib.recipe.OredictionaryNames;
import buildcraft.lib.recipe.RecipeBuilderShaped;
>>>>>>>
<<<<<<<
builder.map('t', BCBlocks.FACTORY_TANK, "blockGlassColorless");
builder.setResult(new ItemStack(BCBlocks.FACTORY_FLOOD_GATE));
builder.register();
=======
builder.map('t', BCBlocks.FACTORY_TANK, OredictionaryNames.GLASS_COLOURLESS);
GameRegistry.addRecipe(builder.build());
>>>>>>>
builder.map('t', BCBlocks.FACTORY_TANK, OredictionaryNames.GLASS_COLOURLESS);
builder.setResult(new ItemStack(BCBlocks.FACTORY_FLOOD_GATE));
builder.register(); |
<<<<<<<
=======
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet3Chat;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.Ticket;
import net.minecraftforge.common.ForgeChunkManager.Type;
import net.minecraftforge.common.ForgeDirection;
>>>>>>> |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
=======
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.common.util.ForgeDirection;
>>>>>>>
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import buildcraft.BuildCraftTransport; |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
import net.minecraftforge.fml.common.network.IGuiHandler;
=======
import cpw.mods.fml.common.network.IGuiHandler;
>>>>>>>
import net.minecraftforge.fml.common.network.IGuiHandler;
<<<<<<<
return null;
}
switch (id) {
case GuiIds.PIPE_DIAMOND:
return new ContainerDiamondPipe(player, (IDiamondPipe) pipe.getPipe());
case GuiIds.PIPE_EMERALD_ITEM:
return new ContainerEmeraldPipe(player, (PipeItemsEmerald) pipe.getPipe());
case GuiIds.PIPE_LOGEMERALD_ITEM:
return new ContainerEmzuliPipe(player, (PipeItemsEmzuli) pipe.getPipe());
case GuiIds.PIPE_EMERALD_FLUID:
return new ContainerEmeraldFluidPipe(player, (PipeFluidsEmerald) pipe.getPipe());
case GuiIds.GATES:
return new ContainerGateInterface(player, pipe.getPipe());
default:
return null;
}
} catch (Exception ex) {
BCLog.logger.log(Level.ERROR, "Failed to open GUI", ex);
}
return null;
}
@Override
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
BlockPos pos = new BlockPos(x, y, z);
try {
if (world.isAirBlock(pos)) {
return null;
}
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileFilteredBuffer) {
TileFilteredBuffer filteredBuffer = (TileFilteredBuffer) tile;
return new GuiFilteredBuffer(player, filteredBuffer);
}
if (!(tile instanceof TileGenericPipe)) {
return null;
}
TileGenericPipe pipe = (TileGenericPipe) tile;
if (pipe.pipe == null) {
return null;
}
switch (id) {
case GuiIds.PIPE_DIAMOND:
return new GuiDiamondPipe(player, (IDiamondPipe) pipe.pipe);
case GuiIds.PIPE_EMERALD_ITEM:
return new GuiEmeraldPipe(player, (PipeItemsEmerald) pipe.pipe);
case GuiIds.PIPE_LOGEMERALD_ITEM:
return new GuiEmzuliPipe(player, (PipeItemsEmzuli) pipe.pipe);
case GuiIds.PIPE_EMERALD_FLUID:
return new GuiEmeraldFluidPipe(player, (PipeFluidsEmerald) pipe.pipe);
case GuiIds.GATES:
return new GuiGateInterface(player, pipe.pipe);
default:
return null;
}
} catch (Exception ex) {
BCLog.logger.log(Level.ERROR, "Failed to open GUI", ex);
}
return null;
}
=======
return null;
}
switch (id) {
case GuiIds.PIPE_DIAMOND:
return new ContainerDiamondPipe(player.inventory, (IDiamondPipe) pipe.getPipe());
case GuiIds.PIPE_EMERALD_ITEM:
return new ContainerEmeraldPipe(player.inventory, (PipeItemsEmerald) pipe.getPipe());
case GuiIds.PIPE_LOGEMERALD_ITEM:
return new ContainerEmzuliPipe(player.inventory, (PipeItemsEmzuli) pipe.getPipe());
case GuiIds.PIPE_EMERALD_FLUID:
return new ContainerEmeraldFluidPipe(player.inventory, (PipeFluidsEmerald) pipe.getPipe());
case GuiIds.GATES:
return new ContainerGateInterface(player.inventory, pipe.getPipe());
default:
return null;
}
} catch (Exception ex) {
BCLog.logger.log(Level.ERROR, "Failed to open GUI", ex);
}
return null;
}
@Override
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
try {
if (!world.blockExists(x, y, z)) {
return null;
}
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileFilteredBuffer) {
TileFilteredBuffer filteredBuffer = (TileFilteredBuffer) tile;
return new GuiFilteredBuffer(player.inventory, filteredBuffer);
}
if (!(tile instanceof IPipeTile)) {
return null;
}
IPipeTile pipe = (IPipeTile) tile;
if (pipe.getPipe() == null) {
return null;
}
switch (id) {
case GuiIds.PIPE_DIAMOND:
return new GuiDiamondPipe(player.inventory, (IDiamondPipe) pipe.getPipe());
case GuiIds.PIPE_EMERALD_ITEM:
return new GuiEmeraldPipe(player.inventory, (PipeItemsEmerald) pipe.getPipe());
case GuiIds.PIPE_LOGEMERALD_ITEM:
return new GuiEmzuliPipe(player.inventory, (PipeItemsEmzuli) pipe.getPipe());
case GuiIds.PIPE_EMERALD_FLUID:
return new GuiEmeraldFluidPipe(player.inventory, (PipeFluidsEmerald) pipe.getPipe());
case GuiIds.GATES:
return new GuiGateInterface(player.inventory, pipe.getPipe());
default:
return null;
}
} catch (Exception ex) {
BCLog.logger.log(Level.ERROR, "Failed to open GUI", ex);
}
return null;
}
>>>>>>>
return null;
}
switch (id) {
case GuiIds.PIPE_DIAMOND:
return new GuiDiamondPipe(player, (IDiamondPipe) pipe.getPipe());
case GuiIds.PIPE_EMERALD_ITEM:
return new GuiEmeraldPipe(player, (PipeItemsEmerald) pipe.getPipe());
case GuiIds.PIPE_LOGEMERALD_ITEM:
return new GuiEmzuliPipe(player, (PipeItemsEmzuli) pipe.getPipe());
case GuiIds.PIPE_EMERALD_FLUID:
return new GuiEmeraldFluidPipe(player, (PipeFluidsEmerald) pipe.getPipe());
case GuiIds.GATES:
return new GuiGateInterface(player, pipe.getPipe());
default:
return null;
}
} catch (Exception ex) {
BCLog.logger.log(Level.ERROR, "Failed to open GUI", ex);
}
return null;
} |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
import net.minecraft.util.EnumFacing;
=======
import net.minecraftforge.common.util.ForgeDirection;
>>>>>>>
import net.minecraft.util.EnumFacing;
import buildcraft.BuildCraftEnergy;
<<<<<<<
@Override
public Collection<ITriggerInternal> getInternalTriggers(IStatementContainer container) {
return null;
}
@Override
public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
LinkedList<ITriggerExternal> triggers = new LinkedList<ITriggerExternal>();
if (tile instanceof TileEngineBase) {
triggers.add(BuildCraftEnergy.triggerBlueEngineHeat);
triggers.add(BuildCraftEnergy.triggerGreenEngineHeat);
triggers.add(BuildCraftEnergy.triggerYellowEngineHeat);
triggers.add(BuildCraftEnergy.triggerRedEngineHeat);
triggers.add(BuildCraftEnergy.triggerEngineOverheat);
}
return triggers;
}
=======
@Override
public Collection<ITriggerInternal> getInternalTriggers(IStatementContainer container) {
return null;
}
@Override
public Collection<ITriggerExternal> getExternalTriggers(ForgeDirection side, TileEntity tile) {
LinkedList<ITriggerExternal> triggers = new LinkedList<ITriggerExternal>();
if (tile instanceof TileEngineBase) {
triggers.add(BuildCraftEnergy.triggerBlueEngineHeat);
triggers.add(BuildCraftEnergy.triggerGreenEngineHeat);
triggers.add(BuildCraftEnergy.triggerYellowEngineHeat);
triggers.add(BuildCraftEnergy.triggerRedEngineHeat);
triggers.add(BuildCraftEnergy.triggerEngineOverheat);
}
return triggers;
}
>>>>>>>
@Override
public Collection<ITriggerInternal> getInternalTriggers(IStatementContainer container) {
return null;
}
@Override
public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
LinkedList<ITriggerExternal> triggers = new LinkedList<ITriggerExternal>();
if (tile instanceof TileEngineBase) {
triggers.add(BuildCraftEnergy.triggerBlueEngineHeat);
triggers.add(BuildCraftEnergy.triggerGreenEngineHeat);
triggers.add(BuildCraftEnergy.triggerYellowEngineHeat);
triggers.add(BuildCraftEnergy.triggerRedEngineHeat);
triggers.add(BuildCraftEnergy.triggerEngineOverheat);
}
return triggers;
} |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
protected TileQuarry parent;
private double armSizeX;
private double armSizeZ;
private double xRoot;
private double yRoot;
private double zRoot;
private boolean inProgressionXZ = false;
private boolean inProgressionY = false;
private int headX, headY, headZ;
private EntityResizableCuboid xArm, yArm, zArm, head;
public EntityMechanicalArm(World world) {
super(world);
makeParts(world);
noClip = true;
}
public EntityMechanicalArm(World world, double x, double y, double z, double width, double height, TileQuarry parent) {
this(world);
setPositionAndRotation(parent.getPos().getX(), parent.getPos().getY(), parent.getPos().getZ(), 0, 0);
this.xRoot = x;
this.yRoot = y;
this.zRoot = z;
this.motionX = 0.0;
this.motionY = 0.0;
this.motionZ = 0.0;
setArmSize(width, height);
setHead(x, y - 2, z);
this.parent = parent;
parent.setArm(this);
updatePosition();
}
public void setHead(double x, double y, double z) {
this.headX = (int) (x * 32D);
this.headY = (int) (y * 32D);
this.headZ = (int) (z * 32D);
}
private void setArmSize(double x, double z) {
armSizeX = x;
xArm.xSize = x;
armSizeZ = z;
zArm.zSize = z;
updatePosition();
}
private void makeParts(World world) {
xArm = BuilderProxy.proxy.newDrill(world, 0, 0, 0, 1, 0.5, 0.5);
yArm = BuilderProxy.proxy.newDrill(world, 0, 0, 0, 0.5, 1, 0.5);
zArm = BuilderProxy.proxy.newDrill(world, 0, 0, 0, 0.5, 0.5, 1);
head = BuilderProxy.proxy.newDrillHead(world, 0, 0, 0, 0.2, 1, 0.2);
head.shadowSize = 1.0F;
world.spawnEntityInWorld(xArm);
world.spawnEntityInWorld(yArm);
world.spawnEntityInWorld(zArm);
world.spawnEntityInWorld(head);
}
@Override
protected void entityInit() {}
@Override
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
xRoot = nbttagcompound.getDouble("xRoot");
yRoot = nbttagcompound.getDouble("yRoot");
zRoot = nbttagcompound.getDouble("zRoot");
armSizeX = nbttagcompound.getDouble("armSizeX");
armSizeZ = nbttagcompound.getDouble("armSizeZ");
setArmSize(armSizeX, armSizeZ);
updatePosition();
}
private void findAndJoinQuarry() {
TileEntity te = worldObj.getTileEntity(new BlockPos((int) posX, (int) posY, (int) posZ));
if (te != null && te instanceof TileQuarry) {
parent = (TileQuarry) te;
parent.setArm(this);
} else {
setDead();
}
}
@Override
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setDouble("xRoot", xRoot);
nbttagcompound.setDouble("yRoot", yRoot);
nbttagcompound.setDouble("zRoot", zRoot);
nbttagcompound.setDouble("armSizeX", armSizeX);
nbttagcompound.setDouble("armSizeZ", armSizeZ);
}
@Override
public void onUpdate() {
super.onUpdate();
updatePosition();
if (parent == null) {
findAndJoinQuarry();
}
if (parent == null) {
setDead();
return;
}
}
public void updatePosition() {
double[] headT = getHead();
this.xArm.setPosition(xRoot, yRoot, headT[2] + 0.25);
this.yArm.ySize = yRoot - headT[1] - 1;
this.yArm.setPosition(headT[0] + 0.25, headT[1] + 1, headT[2] + 0.25);
this.zArm.setPosition(headT[0] + 0.25, yRoot, zRoot);
this.head.setPosition(headT[0] + 0.4, headT[1] - 0.01, headT[2] + 0.4);
}
@Override
public void setDead() {
if (worldObj != null && worldObj.isRemote) {
xArm.setDead();
yArm.setDead();
zArm.setDead();
head.setDead();
}
super.setDead();
}
private double[] getHead() {
return new double[] { this.headX / 32D, this.headY / 32D, this.headZ / 32D };
}
=======
protected TileQuarry parent;
private double armSizeX;
private double armSizeZ;
private double xRoot;
private double yRoot;
private double zRoot;
private int headX, headY, headZ;
private EntityBlock xArm, yArm, zArm, head;
public EntityMechanicalArm(World world) {
super(world);
makeParts(world);
noClip = true;
}
public EntityMechanicalArm(World world, double x, double y, double z, double width, double height, TileQuarry parent) {
this(world);
setPositionAndRotation(parent.xCoord, parent.yCoord, parent.zCoord, 0, 0);
this.xRoot = x;
this.yRoot = y;
this.zRoot = z;
this.motionX = 0.0;
this.motionY = 0.0;
this.motionZ = 0.0;
setArmSize(width, height);
setHead(x, y - 2, z);
this.parent = parent;
parent.setArm(this);
updatePosition();
}
void setHead(double x, double y, double z) {
this.headX = (int) (x * 32D);
this.headY = (int) (y * 32D);
this.headZ = (int) (z * 32D);
}
private void setArmSize(double x, double z) {
armSizeX = x;
xArm.iSize = x;
armSizeZ = z;
zArm.kSize = z;
updatePosition();
}
private void makeParts(World world) {
xArm = BuilderProxy.proxy.newDrill(world, 0, 0, 0, 1, 0.5, 0.5, true);
yArm = BuilderProxy.proxy.newDrill(world, 0, 0, 0, 0.5, 1, 0.5, false);
zArm = BuilderProxy.proxy.newDrill(world, 0, 0, 0, 0.5, 0.5, 1, true);
head = BuilderProxy.proxy.newDrillHead(world, 0, 0, 0, 0.2, 1, 0.2);
head.shadowSize = 1.0F;
world.spawnEntityInWorld(xArm);
world.spawnEntityInWorld(yArm);
world.spawnEntityInWorld(zArm);
world.spawnEntityInWorld(head);
}
@Override
protected void entityInit() {
}
@Override
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
xRoot = nbttagcompound.getDouble("xRoot");
yRoot = nbttagcompound.getDouble("yRoot");
zRoot = nbttagcompound.getDouble("zRoot");
armSizeX = nbttagcompound.getDouble("armSizeX");
armSizeZ = nbttagcompound.getDouble("armSizeZ");
setArmSize(armSizeX, armSizeZ);
updatePosition();
}
private void findAndJoinQuarry() {
TileEntity te = worldObj.getTileEntity((int) posX, (int) posY, (int) posZ);
if (te instanceof TileQuarry) {
parent = (TileQuarry) te;
parent.setArm(this);
} else {
setDead();
}
}
@Override
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setDouble("xRoot", xRoot);
nbttagcompound.setDouble("yRoot", yRoot);
nbttagcompound.setDouble("zRoot", zRoot);
nbttagcompound.setDouble("armSizeX", armSizeX);
nbttagcompound.setDouble("armSizeZ", armSizeZ);
}
@Override
public void onUpdate() {
super.onUpdate();
updatePosition();
if (parent == null) {
findAndJoinQuarry();
}
if (parent == null) {
setDead();
return;
}
}
public void updatePosition() {
double[] headT = getHead();
this.xArm.setPosition(xRoot, yRoot, headT[2] + 0.25);
this.yArm.jSize = yRoot - headT[1] - 1;
this.yArm.setPosition(headT[0] + 0.25, headT[1] + 1, headT[2] + 0.25);
this.zArm.setPosition(headT[0] + 0.25, yRoot, zRoot);
this.head.setPosition(headT[0] + 0.4, headT[1], headT[2] + 0.4);
}
@Override
public void setDead() {
if (worldObj != null && worldObj.isRemote) {
xArm.setDead();
yArm.setDead();
zArm.setDead();
head.setDead();
}
super.setDead();
}
private double[] getHead() {
return new double[]{this.headX / 32D, this.headY / 32D, this.headZ / 32D};
}
>>>>>>>
protected TileQuarry parent;
private double armSizeX;
private double armSizeZ;
private double xRoot;
private double yRoot;
private double zRoot;
private int headX, headY, headZ;
private EntityResizableCuboid xArm, yArm, zArm, head;
public EntityMechanicalArm(World world) {
super(world);
makeParts(world);
noClip = true;
}
public EntityMechanicalArm(World world, double x, double y, double z, double width, double height, TileQuarry parent) {
this(world);
setPositionAndRotation(parent.getPos().getX(), parent.getPos().getY(), parent.getPos().getZ(), 0, 0);
this.xRoot = x;
this.yRoot = y;
this.zRoot = z;
this.motionX = 0.0;
this.motionY = 0.0;
this.motionZ = 0.0;
setArmSize(width, height);
setHead(x, y - 2, z);
this.parent = parent;
parent.setArm(this);
updatePosition();
}
public void setHead(double x, double y, double z) {
this.headX = (int) (x * 32D);
this.headY = (int) (y * 32D);
this.headZ = (int) (z * 32D);
}
private void setArmSize(double x, double z) {
armSizeX = x;
xArm.xSize = x;
armSizeZ = z;
zArm.zSize = z;
updatePosition();
}
private void makeParts(World world) {
xArm = BuilderProxy.proxy.newDrill(world, 0, 0, 0, 1, 0.5, 0.5);
yArm = BuilderProxy.proxy.newDrill(world, 0, 0, 0, 0.5, 1, 0.5);
zArm = BuilderProxy.proxy.newDrill(world, 0, 0, 0, 0.5, 0.5, 1);
head = BuilderProxy.proxy.newDrillHead(world, 0, 0, 0, 0.2, 1, 0.2);
head.shadowSize = 1.0F;
world.spawnEntityInWorld(xArm);
world.spawnEntityInWorld(yArm);
world.spawnEntityInWorld(zArm);
world.spawnEntityInWorld(head);
}
@Override
protected void entityInit() {}
@Override
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
xRoot = nbttagcompound.getDouble("xRoot");
yRoot = nbttagcompound.getDouble("yRoot");
zRoot = nbttagcompound.getDouble("zRoot");
armSizeX = nbttagcompound.getDouble("armSizeX");
armSizeZ = nbttagcompound.getDouble("armSizeZ");
setArmSize(armSizeX, armSizeZ);
updatePosition();
}
private void findAndJoinQuarry() {
TileEntity te = worldObj.getTileEntity(new BlockPos((int) posX, (int) posY, (int) posZ));
if (te instanceof TileQuarry) {
parent = (TileQuarry) te;
parent.setArm(this);
} else {
setDead();
}
}
@Override
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setDouble("xRoot", xRoot);
nbttagcompound.setDouble("yRoot", yRoot);
nbttagcompound.setDouble("zRoot", zRoot);
nbttagcompound.setDouble("armSizeX", armSizeX);
nbttagcompound.setDouble("armSizeZ", armSizeZ);
}
@Override
public void onUpdate() {
super.onUpdate();
updatePosition();
if (parent == null) {
findAndJoinQuarry();
}
if (parent == null) {
setDead();
return;
}
}
public void updatePosition() {
double[] headT = getHead();
this.xArm.setPosition(xRoot, yRoot, headT[2] + 0.25);
this.yArm.ySize = yRoot - headT[1] - 1;
this.yArm.setPosition(headT[0] + 0.25, headT[1] + 1, headT[2] + 0.25);
this.zArm.setPosition(headT[0] + 0.25, yRoot, zRoot);
this.head.setPosition(headT[0] + 0.4, headT[1] - 0.01, headT[2] + 0.4);
}
@Override
public void setDead() {
if (worldObj != null && worldObj.isRemote) {
xArm.setDead();
yArm.setDead();
zArm.setDead();
head.setDead();
}
super.setDead();
}
private double[] getHead() {
return new double[] { this.headX / 32D, this.headY / 32D, this.headZ / 32D };
} |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
<<<<<<<
=======
import net.minecraft.entity.player.InventoryPlayer;
>>>>>>>
import net.minecraft.entity.player.InventoryPlayer;
<<<<<<<
private final TilePackager tile;
// private int lastProgress;
public ContainerPackager(EntityPlayer player, TilePackager t) {
super(player, t.getSizeInventory());
this.tile = t;
// sort in order of shift-click!
addSlotToContainer(new SlotValidated(tile, 9, 124, 7));
for (int x = 0; x < 9; x++) {
addSlotToContainer(new Slot(tile, x, 8 + x * 18, 84));
}
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++) {
addSlotToContainer(new SlotPackager(tile, 12 + x + y * 3, 30 + x * 18, 17 + y * 18));
}
}
addSlotToContainer(new Slot(tile, 10, 108, 31));
addSlotToContainer(new SlotOutput(tile, 11, 123, 59));
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 9; x++) {
addSlotToContainer(new Slot(player.inventory, x + y * 9 + 9, 8 + x * 18, 115 + y * 18));
}
}
for (int x = 0; x < 9; x++) {
addSlotToContainer(new Slot(player.inventory, x, 8 + x * 18, 173));
}
onCraftMatrixChanged(tile);
}
@Override
public void updateProgressBar(int id, int data) {
/* switch (id) { case 0: tile.progress = data; break; } */
}
@Override
public ItemStack slotClick(int slotNum, int mouseButton, int modifier, EntityPlayer player) {
ItemStack out = super.slotClick(slotNum, mouseButton, modifier, player);
Slot slot = slotNum < 0 ? null : (Slot) this.inventorySlots.get(slotNum);
if (slot instanceof SlotPackager) {
int idx = slot.getSlotIndex() - 12;
ItemStack stack = player != null && player.inventory != null ? player.inventory.getItemStack() : null;
if (stack == null) {
tile.setPatternSlot(idx, !tile.isPatternSlotSet(idx));
} else {
tile.setPatternSlot(idx, true);
}
tile.sendNetworkUpdate();
}
return out;
}
@Override
public boolean canInteractWith(EntityPlayer entityplayer) {
return tile.isUseableByPlayer(entityplayer);
}
=======
private final TilePackager tile;
public ContainerPackager(InventoryPlayer inventoryplayer, TilePackager t) {
super(t.getSizeInventory());
this.tile = t;
// sort in order of shift-click!
addSlotToContainer(new SlotValidated(tile, 9, 124, 7));
for (int x = 0; x < 9; x++) {
addSlotToContainer(new Slot(tile, x, 8 + x * 18, 84));
}
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++) {
addSlotToContainer(new SlotPackager(tile.inventoryPattern, x + y * 3, 30 + x * 18, 17 + y * 18));
}
}
// addSlotToContainer(new Slot(tile, 10, 108, 31));
addSlotToContainer(new SlotOutput(tile, 11, 123, 59));
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 9; x++) {
addSlotToContainer(new Slot(inventoryplayer, x + y * 9 + 9, 8 + x * 18, 115 + y * 18));
}
}
for (int x = 0; x < 9; x++) {
addSlotToContainer(new Slot(inventoryplayer, x, 8 + x * 18, 173));
}
onCraftMatrixChanged(tile);
}
@Override
public ItemStack slotClick(int slotNum, int mouseButton, int modifier, EntityPlayer player) {
Slot slot = slotNum < 0 ? null : (Slot) this.inventorySlots.get(slotNum);
ItemStack out = super.slotClick(slotNum, mouseButton, slot instanceof SlotPackager ? 0 : modifier, player);
if (slot instanceof SlotPackager) {
int idx = slot.getSlotIndex();
ItemStack stack = player != null && player.inventory != null ? player.inventory.getItemStack() : null;
if (stack == null) {
tile.setPatternSlot(idx, !tile.isPatternSlotSet(idx));
} else {
tile.setPatternSlot(idx, true);
}
tile.sendNetworkUpdate();
}
return out;
}
@Override
public boolean canInteractWith(EntityPlayer entityplayer) {
return tile.isUseableByPlayer(entityplayer);
}
>>>>>>>
private final TilePackager tile;
public ContainerPackager(EntityPlayer player, TilePackager t) {
super(player, t.getSizeInventory());
this.tile = t;
// sort in order of shift-click!
addSlotToContainer(new SlotValidated(tile, 9, 124, 7));
for (int x = 0; x < 9; x++) {
addSlotToContainer(new Slot(tile, x, 8 + x * 18, 84));
}
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++) {
addSlotToContainer(new SlotPackager(tile.inventoryPattern, x + y * 3, 30 + x * 18, 17 + y * 18));
}
}
// addSlotToContainer(new Slot(tile, 10, 108, 31));
addSlotToContainer(new SlotOutput(tile, 11, 123, 59));
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 9; x++) {
addSlotToContainer(new Slot(player.inventory, x + y * 9 + 9, 8 + x * 18, 115 + y * 18));
}
}
for (int x = 0; x < 9; x++) {
addSlotToContainer(new Slot(player.inventory, x, 8 + x * 18, 173));
}
onCraftMatrixChanged(tile);
}
@Override
public ItemStack slotClick(int slotNum, int mouseButton, int modifier, EntityPlayer player) {
Slot slot = slotNum < 0 ? null : (Slot) this.inventorySlots.get(slotNum);
ItemStack out = super.slotClick(slotNum, mouseButton, slot instanceof SlotPackager ? 0 : modifier, player);
if (slot instanceof SlotPackager) {
int idx = slot.getSlotIndex();
ItemStack stack = player != null && player.inventory != null ? player.inventory.getItemStack() : null;
if (stack == null) {
tile.setPatternSlot(idx, !tile.isPatternSlotSet(idx));
} else {
tile.setPatternSlot(idx, true);
}
tile.sendNetworkUpdate();
}
return out;
}
@Override
public boolean canInteractWith(EntityPlayer entityplayer) {
return tile.isUseableByPlayer(entityplayer);
} |
<<<<<<<
public List<String> getSegmentations(List<String> tokenNums, List<String> parses) {
=======
public List<String> getSegmentations(List<String> sentenceIdxs,
List<String> parses,
Set<String> allRelatedWords)
{
>>>>>>>
public List<String> getSegmentations(List<String> sentenceIdxs, List<String> parses) { |
<<<<<<<
import buildcraft.core.inventory.InventoryMapper;
import buildcraft.core.inventory.SimpleInventory;
=======
import buildcraft.core.blueprints.BptBase;
import buildcraft.core.blueprints.BptBlueprint;
import buildcraft.core.blueprints.BptBuilderBase;
import buildcraft.core.blueprints.BptBuilderBlueprint;
import buildcraft.core.blueprints.BptBuilderTemplate;
import buildcraft.core.blueprints.BptContext;
import buildcraft.core.inventory.InvUtils;
>>>>>>>
import buildcraft.core.inventory.InvUtils;
import buildcraft.core.inventory.InventoryMapper;
import buildcraft.core.inventory.SimpleInventory;
<<<<<<<
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
=======
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
InvUtils.readStacksFromNBT(nbttagcompound, "Items", items);
>>>>>>>
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
<<<<<<<
inv.writeToNBT(nbt);
=======
InvUtils.writeStacksToNBT(nbttagcompound, "Items", items);
>>>>>>>
inv.writeToNBT(nbt); |
<<<<<<<
import net.minecraftforge.fluids.FluidStack;
import buildcraft.core.lib.network.PacketCoordinates;
import buildcraft.core.lib.utils.BitSetUtils;
=======
import buildcraft.core.network.PacketCoordinates;
>>>>>>>
import buildcraft.core.lib.network.PacketCoordinates;
import buildcraft.core.lib.utils.BitSetUtils; |
<<<<<<<
=======
import buildcraft.lib.gui.config.GuiConfigManager;
import buildcraft.lib.item.IItemBuildCraft;
import buildcraft.lib.item.ItemManager;
>>>>>>>
import buildcraft.lib.gui.config.GuiConfigManager;
import buildcraft.lib.item.IItemBuildCraft;
import buildcraft.lib.item.ItemManager;
<<<<<<<
=======
ItemManager.fmlInitClient();
GuiConfigManager.loadFromConfigFile();
>>>>>>>
GuiConfigManager.loadFromConfigFile(); |
<<<<<<<
public List<String> getSegmentations(List<String> tokenNums, List<String> parseLines) {
=======
public List<String> getSegmentations(List<String> sentenceIdxs, List<String> parseLines, Set<String> allRelatedWords) {
>>>>>>>
public List<String> getSegmentations(List<String> sentenceIdxs, List<String> parseLines) { |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
public DockingStation targetStation;
private IStationFilter filter;
private IZone zone;
public AIRobotSearchStation(EntityRobotBase iRobot) {
super(iRobot);
}
public AIRobotSearchStation(EntityRobotBase iRobot, IStationFilter iFilter, IZone iZone) {
this(iRobot);
filter = iFilter;
zone = iZone;
}
@Override
public void start() {
if (robot.getDockingStation() != null && filter.matches(robot.getDockingStation())) {
targetStation = robot.getDockingStation();
terminate();
return;
}
double potentialStationDistance = Float.MAX_VALUE;
DockingStation potentialStation = null;
for (DockingStation station : robot.getRegistry().getStations()) {
if (station.isTaken() && station.robotIdTaking() != robot.getRobotId()) {
continue;
}
if (zone != null && !zone.contains(Utils.convert(station.getPos()))) {
continue;
}
if (filter.matches(station)) {
if (ActionStationForbidRobot.isForbidden(station, robot)) {
continue;
}
double distance = Utils.getPos(robot).distanceSq(station.getPos());
if (potentialStation == null || distance < potentialStationDistance) {
potentialStation = station;
potentialStationDistance = distance;
}
}
}
if (potentialStation != null) {
targetStation = potentialStation;
}
terminate();
}
@Override
public void delegateAIEnded(AIRobot ai) {
terminate();
}
@Override
public boolean success() {
return targetStation != null;
}
=======
public DockingStation targetStation;
private IStationFilter filter;
private IZone zone;
public AIRobotSearchStation(EntityRobotBase iRobot) {
super(iRobot);
}
public AIRobotSearchStation(EntityRobotBase iRobot, IStationFilter iFilter, IZone iZone) {
this(iRobot);
filter = iFilter;
zone = iZone;
}
@Override
public void start() {
if (robot.getDockingStation() != null
&& filter.matches(robot.getDockingStation())) {
targetStation = robot.getDockingStation();
terminate();
return;
}
double potentialStationDistance = Float.MAX_VALUE;
DockingStation potentialStation = null;
for (DockingStation station : robot.getRegistry().getStations()) {
if (!station.isInitialized()) {
continue;
}
if (station.isTaken() && station.robotIdTaking() != robot.getRobotId()) {
continue;
}
if (zone != null && !zone.contains(station.x(), station.y(), station.z())) {
continue;
}
if (filter.matches(station)) {
if (ActionStationForbidRobot.isForbidden(station, robot)) {
continue;
}
double dx = robot.posX - station.x();
double dy = robot.posY - station.y();
double dz = robot.posZ - station.z();
double distance = dx * dx + dy * dy + dz * dz;
if (potentialStation == null || distance < potentialStationDistance) {
potentialStation = station;
potentialStationDistance = distance;
}
}
}
if (potentialStation != null) {
targetStation = potentialStation;
}
terminate();
}
@Override
public void delegateAIEnded(AIRobot ai) {
terminate();
}
@Override
public boolean success() {
return targetStation != null;
}
>>>>>>>
public DockingStation targetStation;
private IStationFilter filter;
private IZone zone;
public AIRobotSearchStation(EntityRobotBase iRobot) {
super(iRobot);
}
public AIRobotSearchStation(EntityRobotBase iRobot, IStationFilter iFilter, IZone iZone) {
this(iRobot);
filter = iFilter;
zone = iZone;
}
@Override
public void start() {
if (robot.getDockingStation() != null && filter.matches(robot.getDockingStation())) {
targetStation = robot.getDockingStation();
terminate();
return;
}
double potentialStationDistance = Float.MAX_VALUE;
DockingStation potentialStation = null;
for (DockingStation station : robot.getRegistry().getStations()) {
if (!station.isInitialized()) {
continue;
}
if (station.isTaken() && station.robotIdTaking() != robot.getRobotId()) {
continue;
}
if (zone != null && !zone.contains(Utils.convert(station.getPos()))) {
continue;
}
if (filter.matches(station)) {
if (ActionStationForbidRobot.isForbidden(station, robot)) {
continue;
}
double distance = Utils.getPos(robot).distanceSq(station.getPos());
if (potentialStation == null || distance < potentialStationDistance) {
potentialStation = station;
potentialStationDistance = distance;
}
}
}
if (potentialStation != null) {
targetStation = potentialStation;
}
terminate();
}
@Override
public void delegateAIEnded(AIRobot ai) {
terminate();
}
@Override
public boolean success() {
return targetStation != null;
} |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
private static final ResourceLocation TEXTURE = new ResourceLocation("buildcraftbuilders:textures/gui/library_rw.png");
private GuiButton nextPageButton;
private GuiButton prevPageButton;
private GuiButton deleteButton;
private TileBlueprintLibrary library;
public GuiBlueprintLibrary(EntityPlayer player, TileBlueprintLibrary library) {
super(new ContainerBlueprintLibrary(player, library), library, TEXTURE);
xSize = 234;
ySize = 225;
this.library = library;
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
super.initGui();
prevPageButton = new GuiButton(0, guiLeft + 158, guiTop + 23, 20, 20, "<");
nextPageButton = new GuiButton(1, guiLeft + 180, guiTop + 23, 20, 20, ">");
buttonList.add(prevPageButton);
buttonList.add(nextPageButton);
deleteButton = new GuiButton(2, guiLeft + 158, guiTop + 114, 25, 20, StringUtils.localize("gui.del"));
buttonList.add(deleteButton);
library.refresh();
checkDelete();
checkPages();
}
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
String title = StringUtils.localize("tile.libraryBlock.name");
fontRendererObj.drawString(title, getCenteredOffset(title), 6, 0x404040);
int c = 0;
for (LibraryId bpt : library.currentPage) {
String name = bpt.name;
if (name.length() > DefaultProps.MAX_NAME_SIZE) {
name = name.substring(0, DefaultProps.MAX_NAME_SIZE);
}
if (c == library.selected) {
int l1 = 8;
int i2 = 24;
// TODO
// if (bpt.kind == Kind.Blueprint) {
// drawGradientRect(l1, i2 + 9 * c, l1 + 146, i2 + 9 * (c + 1), 0xFFA0C0F0, 0xFFA0C0F0);
// } else {
drawGradientRect(l1, i2 + 9 * c, l1 + 146, i2 + 9 * (c + 1), 0x80ffffff, 0x80ffffff);
// }
}
fontRendererObj.drawString(name, 9, 25 + 9 * c, LibraryAPI.getHandlerFor(bpt.extension).getTextColor());
c++;
}
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(TEXTURE);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int inP = (int) (library.progressIn / 100.0 * 22.0);
int outP = (int) (library.progressOut / 100.0 * 22.0);
drawTexturedModalRect(guiLeft + 186 + 22 - inP, guiTop + 61, 234 + 22 - inP, 16, inP, 16);
drawTexturedModalRect(guiLeft + 186, guiTop + 78, 234, 0, outP, 16);
}
@Override
protected void actionPerformed(GuiButton button) {
if (button == nextPageButton) {
library.pageNext();
} else if (button == prevPageButton) {
library.pagePrev();
} else if (deleteButton != null && button == deleteButton) {
library.deleteSelectedBpt();
}
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
int x = mouseX - guiLeft;
int y = mouseY - guiTop;
if (x >= 8 && x <= 88) {
int ySlot = (y - 24) / 9;
if (ySlot >= 0 && ySlot <= 11) {
if (ySlot < library.currentPage.size()) {
library.selectBlueprint(ySlot);
}
}
}
checkDelete();
checkPages();
}
protected void checkDelete() {
if (library.selected != -1) {
deleteButton.enabled = true;
} else {
deleteButton.enabled = false;
}
}
protected void checkPages() {
if (library.pageId != 0) {
prevPageButton.enabled = true;
} else {
prevPageButton.enabled = false;
}
if (library.pageId < BuildCraftBuilders.clientDB.getPageNumber() - 1) {
nextPageButton.enabled = true;
} else {
nextPageButton.enabled = false;
}
}
=======
private static final ResourceLocation TEXTURE = new ResourceLocation("buildcraftbuilders:textures/gui/library_rw.png");
private GuiButton deleteButton;
private TileBlueprintLibrary library;
public GuiBlueprintLibrary(EntityPlayer player, TileBlueprintLibrary library) {
super(new ContainerBlueprintLibrary(player, library), library, TEXTURE);
xSize = 244;
ySize = 220;
this.library = library;
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
super.initGui();
deleteButton = new GuiButton(2, guiLeft + 174, guiTop + 109, 25, 20, StringUtils.localize("gui.del"));
buttonList.add(deleteButton);
library.refresh();
checkDelete();
}
private ContainerBlueprintLibrary getLibraryContainer() {
return (ContainerBlueprintLibrary) getContainer();
}
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
String title = StringUtils.localize("tile.libraryBlock.name");
fontRendererObj.drawString(title, getCenteredOffset(title), 6, 0x404040);
int off = getLibraryContainer().scrollbarWidget.getPosition();
for (int i = off; i < (off + 12); i++) {
if (i >= library.entries.size()) {
break;
}
LibraryId bpt = library.entries.get(i);
String name = bpt.name;
if (name.length() > DefaultProps.MAX_NAME_SIZE) {
name = name.substring(0, DefaultProps.MAX_NAME_SIZE);
}
if (i == library.selected) {
int l1 = 8;
int i2 = 22;
drawGradientRect(l1, i2 + 9 * (i - off), l1 + 146, i2 + 9 * (i - off + 1), 0x80ffffff, 0x80ffffff);
}
while (fontRendererObj.getStringWidth(name) > (160 - 9)) {
name = name.substring(0, name.length() - 1);
}
fontRendererObj.drawString(name, 9, 23 + 9 * (i - off), LibraryAPI.getHandlerFor(bpt.extension).getTextColor());
}
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(TEXTURE);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
getLibraryContainer().scrollbarWidget.hidden = library.entries.size() <= 12;
getLibraryContainer().scrollbarWidget.setLength(Math.max(0, library.entries.size() - 12));
drawWidgets(x, y);
int inP = library.progressIn * 22 / 100;
int outP = library.progressOut * 22 / 100;
drawTexturedModalRect(guiLeft + 194 + 22 - inP, guiTop + 57, 234 + 22 - inP, 240, inP, 16);
drawTexturedModalRect(guiLeft + 194, guiTop + 79, 234, 224, outP, 16);
}
@Override
protected void actionPerformed(GuiButton button) {
if (deleteButton != null && button == deleteButton) {
library.deleteSelectedBpt();
}
}
@Override
protected void mouseClicked(int i, int j, int k) {
super.mouseClicked(i, j, k);
int x = i - guiLeft;
int y = j - guiTop;
if (x >= 8 && x <= 161) {
int ySlot = (y - 22) / 9 + getLibraryContainer().scrollbarWidget.getPosition();
if (ySlot > -1 && ySlot < library.entries.size()) {
library.selectBlueprint(ySlot);
}
}
checkDelete();
}
protected void checkDelete() {
if (library.selected != -1) {
deleteButton.enabled = true;
} else {
deleteButton.enabled = false;
}
}
>>>>>>>
private static final ResourceLocation TEXTURE = new ResourceLocation("buildcraftbuilders:textures/gui/library_rw.png");
private GuiButton deleteButton;
private TileBlueprintLibrary library;
public GuiBlueprintLibrary(EntityPlayer player, TileBlueprintLibrary library) {
super(new ContainerBlueprintLibrary(player, library), library, TEXTURE);
xSize = 244;
ySize = 220;
this.library = library;
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
super.initGui();
deleteButton = new GuiButton(2, guiLeft + 174, guiTop + 109, 25, 20, StringUtils.localize("gui.del"));
buttonList.add(deleteButton);
library.refresh();
checkDelete();
}
private ContainerBlueprintLibrary getLibraryContainer() {
return (ContainerBlueprintLibrary) getContainer();
}
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
String title = StringUtils.localize("tile.libraryBlock.name");
fontRendererObj.drawString(title, getCenteredOffset(title), 6, 0x404040);
int off = getLibraryContainer().scrollbarWidget.getPosition();
for (int i = off; i < (off + 12); i++) {
if (i >= library.entries.size()) {
break;
}
LibraryId bpt = library.entries.get(i);
String name = bpt.name;
if (name.length() > DefaultProps.MAX_NAME_SIZE) {
name = name.substring(0, DefaultProps.MAX_NAME_SIZE);
}
if (i == library.selected) {
int l1 = 8;
int i2 = 22;
drawGradientRect(l1, i2 + 9 * (i - off), l1 + 146, i2 + 9 * (i - off + 1), 0x80ffffff, 0x80ffffff);
}
while (fontRendererObj.getStringWidth(name) > (160 - 9)) {
name = name.substring(0, name.length() - 1);
}
fontRendererObj.drawString(name, 9, 23 + 9 * (i - off), LibraryAPI.getHandlerFor(bpt.extension).getTextColor());
}
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(TEXTURE);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
getLibraryContainer().scrollbarWidget.hidden = library.entries.size() <= 12;
getLibraryContainer().scrollbarWidget.setLength(Math.max(0, library.entries.size() - 12));
drawWidgets(x, y);
int inP = library.progressIn * 22 / 100;
int outP = library.progressOut * 22 / 100;
drawTexturedModalRect(guiLeft + 194 + 22 - inP, guiTop + 57, 234 + 22 - inP, 240, inP, 16);
drawTexturedModalRect(guiLeft + 194, guiTop + 79, 234, 224, outP, 16);
}
@Override
protected void actionPerformed(GuiButton button) {
if (deleteButton != null && button == deleteButton) {
library.deleteSelectedBpt();
}
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
int x = mouseX - guiLeft;
int y = mouseY - guiTop;
if (x >= 8 && x <= 161) {
int ySlot = (y - 22) / 9 + getLibraryContainer().scrollbarWidget.getPosition();
if (ySlot > -1 && ySlot < library.entries.size()) {
library.selectBlueprint(ySlot);
}
}
checkDelete();
}
protected void checkDelete() {
if (library.selected != -1) {
deleteButton.enabled = true;
} else {
deleteButton.enabled = false;
}
} |
<<<<<<<
import buildcraft.lib.misc.CapUtil;
import buildcraft.lib.misc.LocaleUtil;
=======
import buildcraft.core.BCCoreConfig;
import buildcraft.lib.misc.MathUtil;
import buildcraft.lib.misc.StringUtilBC;
>>>>>>>
import buildcraft.core.BCCoreConfig;
import buildcraft.lib.misc.CapUtil;
import buildcraft.lib.misc.LocaleUtil;
import buildcraft.lib.misc.MathUtil;
<<<<<<<
String line = " - " + LocaleUtil.localizeFacing(part.face) + " = ";
line += (section.amount > 0 ? TextFormatting.GREEN : "");
line += section.amount + "" + TextFormatting.RESET + "mB";
=======
String line = " - " + StringUtilBC.getLocalized(part.face) + " = ";
int amount = isRemote ? section.target : section.amount;
line += (amount > 0 ? TextFormatting.GREEN : "");
line += amount + "" + TextFormatting.RESET + "mB";
>>>>>>>
String line = " - " + LocaleUtil.localizeFacing(part.face) + " = ";
int amount = isRemote ? section.target : section.amount;
line += (amount > 0 ? TextFormatting.GREEN : "");
line += amount + "" + TextFormatting.RESET + "mB"; |
<<<<<<<
for(String sentenceIdxStr: sentenceIdxs) {
final int sentNum = Integer.parseInt(sentenceIdxStr);
final String parse = parseLines.get(sentNum);
=======
for(int sentenceIdx: sentenceIdxs) {
// the last tsv field is the index of the sentence in `parses`
final String parse = parseLines.get(sentenceIdx);
>>>>>>>
for(int sentenceIdx: sentenceIdxs) {
// the last tsv field is the index of the sentence in `parses`
final String parse = parseLines.get(sentenceIdx);
<<<<<<<
final List<List<Integer>> ngramIndices = getSegmentation(sentence);
result.add(getTestLine(ngramIndices) + "\t" + sentNum);
=======
final List<String> ngramIndices = getSegmentation(sentence);
result.add(getTestLine(ngramIndices) + "\t" + sentenceIdx);
>>>>>>>
final List<List<Integer>> ngramIndices = getSegmentation(sentence);
result.add(getTestLine(ngramIndices) + "\t" + sentenceIdx); |
<<<<<<<
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
=======
>>>>>>>
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
<<<<<<<
// Others
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
EnumFacing orientation = placer.getHorizontalFacing();
world.setBlockState(pos, state.withProperty(PROP_FACING, orientation.getOpposite()));
super.onBlockPlacedBy(world, pos, state, placer, stack);
=======
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return null;
>>>>>>>
// BlockState
@Override
protected void addProperties(List<IProperty<?>> properties) {
super.addProperties(properties);
properties.add(BLUEPRINT_TYPE);
}
// Others
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
EnumFacing orientation = placer.getHorizontalFacing();
world.setBlockState(pos, state.withProperty(PROP_FACING, orientation.getOpposite()));
super.onBlockPlacedBy(world, pos, state, placer, stack);
<<<<<<<
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileBuilder_Neptune();
=======
protected void addProperties(List<IProperty<?>> properties) {
super.addProperties(properties);
properties.add(BLUEPRINT_TYPE);
>>>>>>>
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileBuilder_Neptune(); |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
<<<<<<<
@Override
public Class getHandledClass() {
return BuildCraftContainer.class;
}
@Override
public ICommandReceiver handle(EntityPlayer player, ByteBuf data, World world) {
Container container = player.openContainer;
if (container != null && container instanceof ICommandReceiver) {
return (ICommandReceiver) container;
}
return null;
}
=======
@Override
public Class<?> getHandledClass() {
return Container.class;
}
>>>>>>>
@Override
public Class<?> getHandledClass() {
return Container.class;
}
@Override
public ICommandReceiver handle(EntityPlayer player, ByteBuf data, World world) {
Container container = player.openContainer;
if (container != null && container instanceof ICommandReceiver) {
return (ICommandReceiver) container;
}
return null;
} |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
import buildcraft.core.lib.block.BlockBuildCraftBase;
public class BlockPlainPipe extends BlockBuildCraftBase {
public BlockPlainPipe() {
super(Material.glass, null, false);
minX = CoreConstants.PIPE_MIN_POS;
minY = 0;
minZ = CoreConstants.PIPE_MIN_POS;
maxX = CoreConstants.PIPE_MAX_POS;
maxY = 1;
maxZ = CoreConstants.PIPE_MAX_POS;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean isNormalCube() {
return false;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
list.add(new ItemStack(this));
}
@Override
public Item getItemDropped(IBlockState state, Random random, int j) {
return null;
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
return Collections.emptyList();
}
@Override
public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) {
return true;
}
@Override
public AxisAlignedBB getBox(IBlockAccess world, BlockPos pos, IBlockState state) {
return new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ);
}
=======
public class BlockPlainPipe extends Block {
public BlockPlainPipe() {
super(Material.glass);
minX = CoreConstants.PIPE_MIN_POS;
minY = 0.0;
minZ = CoreConstants.PIPE_MIN_POS;
maxX = CoreConstants.PIPE_MAX_POS;
maxY = 1.0;
maxZ = CoreConstants.PIPE_MAX_POS;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isNormalCube() {
return false;
}
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
list.add(new ItemStack(this));
}
@Override
public Item getItemDropped(int i, Random random, int j) {
return null;
}
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
return new ArrayList<ItemStack>();
}
@Override
public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity) {
return true;
}
@Override
public void registerBlockIcons(IIconRegister register) {
blockIcon = register.registerIcon("buildcraftfactory:plainPipeBlock/default");
}
>>>>>>>
import buildcraft.core.lib.block.BlockBuildCraftBase;
public class BlockPlainPipe extends BlockBuildCraftBase {
public BlockPlainPipe() {
super(Material.glass, null, false);
minX = CoreConstants.PIPE_MIN_POS;
minY = 0;
minZ = CoreConstants.PIPE_MIN_POS;
maxX = CoreConstants.PIPE_MAX_POS;
maxY = 1;
maxZ = CoreConstants.PIPE_MAX_POS;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean isNormalCube() {
return false;
}
@Override
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> list) {
list.add(new ItemStack(this));
}
@Override
public Item getItemDropped(IBlockState state, Random random, int j) {
return null;
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
return Collections.emptyList();
}
@Override
public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) {
return true;
}
@Override
public AxisAlignedBB getBox(IBlockAccess world, BlockPos pos, IBlockState state) {
return new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ);
} |
<<<<<<<
@Override
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) {
if (sticky) {
entityIn.setInWeb();
}
}
public void setSticky(boolean sticky) {
this.sticky = sticky;
}
=======
@Override
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) {
return blockMaterial.getCanBurn() ? 200 : 0;
}
@Override
public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) {
return blockMaterial.getCanBurn() ? 200 : 0;
}
>>>>>>>
@Override
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) {
return blockMaterial.getCanBurn() ? 200 : 0;
}
@Override
public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) {
return blockMaterial.getCanBurn() ? 200 : 0;
}
@Override
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) {
if (sticky) {
entityIn.setInWeb();
}
}
public void setSticky(boolean sticky) {
this.sticky = sticky;
} |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
=======
import buildcraft.core.network.PacketIds;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.transport.Pipe;
>>>>>>>
<<<<<<<
public FluidRenderData renderCache = new FluidRenderData();
public BitSet delta;
private short fluidID = 0;
private int color = 0;
private int[] amount = new int[7];
public byte[] flow = new byte[6];
public PacketFluidUpdate(TileGenericPipe tileG) {
super(tileG);
}
public PacketFluidUpdate(TileGenericPipe tileG, boolean chunkPacket) {
this(tileG);
this.isChunkDataPacket = chunkPacket;
}
public PacketFluidUpdate() {}
@Override
public void readData(ByteBuf data) {
super.readData(data);
byte[] dBytes = new byte[1];
data.readBytes(dBytes);
delta = BitSetUtils.fromByteArray(dBytes);
if (delta.get(0)) {
fluidID = data.readShort();
if (fluidID != 0) {
color = data.readInt();
}
}
for (int dir = 0; dir < 7; dir++) {
if (delta.get(dir + 1)) {
amount[dir] = data.readShort();
}
if (dir < 6) {
flow[dir] = data.readByte();
}
}
}
@Override
public void writeData(ByteBuf data) {
super.writeData(data);
byte[] dBytes = BitSetUtils.toByteArray(delta, 1);
// System.out.printf("write %d, %d, %d = %s, %s%n", posX, posY, posZ, Arrays.toString(dBytes), delta);
data.writeBytes(dBytes);
if (delta.get(0)) {
data.writeShort(renderCache.fluidID);
if (renderCache.fluidID != 0) {
data.writeInt(renderCache.color);
}
}
for (int dir = 0; dir < 7; dir++) {
if (delta.get(dir + 1)) {
data.writeShort(renderCache.amount[dir]);
}
if (dir < 6) {
data.writeByte(flow[dir]);
}
}
}
@Override
public void applyData(World world, EntityPlayer player) {
if (world.isAirBlock(pos)) {
return;
}
TileEntity entity = world.getTileEntity(pos);
if (!(entity instanceof TileGenericPipe)) {
return;
}
TileGenericPipe pipe = (TileGenericPipe) entity;
if (pipe.pipe == null) {
return;
}
if (!(pipe.pipe.transport instanceof PipeTransportFluids)) {
return;
}
PipeTransportFluids trans = (PipeTransportFluids) pipe.pipe.transport;
// boolean fluidBefore = false;
// boolean fluidAfter = false;
renderCache = trans.renderCache;
renderCache.flow = flow;
// System.out.printf("read %d, %d, %d = %s, %s%n", posX, posY, posZ, Arrays.toString(dBytes), delta);
if (delta.get(0)) {
renderCache.fluidID = fluidID;
Fluid fluid = FluidRegistry.getFluid(fluidID);
if (fluid == null) {
trans.fluidType = null;
} else {
trans.fluidType = new FluidStack(fluid, 1);
}
renderCache.color = color;
}
for (int dir = 0; dir < 7; dir++) {
if (delta.get(dir + 1)) {
// boolean before = renderCache.amount[dir] > 0;
renderCache.amount[dir] = amount[dir];
// boolean after = renderCache.amount[dir] > 0;
// fluidBefore |= before;
// fluidAfter |= after;
}
if (dir < 6) {
trans.clientDisplayFlowConnection[dir] = flow[dir];
}
}
// TODO Fluid shader rendering (unused for now)
// if (fluidBefore && !fluidAfter) {
// FluidShaderManager.INSTANCE.getRenderer(Minecraft.getMinecraft().theWorld).removeFluidTransport(trans);
// }
// if (!fluidBefore && fluidAfter) {
// FluidShaderManager.INSTANCE.getRenderer(Minecraft.getMinecraft().theWorld).addFluidTransport(trans);
// }
}
=======
public FluidRenderData renderCache = new FluidRenderData();
public BitSet delta;
private boolean largeFluidCapacity;
public PacketFluidUpdate(int xCoord, int yCoord, int zCoord) {
super(PacketIds.PIPE_LIQUID, xCoord, yCoord, zCoord);
}
public PacketFluidUpdate(int xCoord, int yCoord, int zCoord, boolean chunkPacket, boolean largeFluidCapacity) {
super(PacketIds.PIPE_LIQUID, xCoord, yCoord, zCoord);
this.isChunkDataPacket = chunkPacket;
this.largeFluidCapacity = largeFluidCapacity;
}
public PacketFluidUpdate() {
}
@Override
public void readData(ByteBuf data) {
super.readData(data);
World world = CoreProxy.proxy.getClientWorld();
if (!world.blockExists(posX, posY, posZ)) {
return;
}
TileEntity entity = world.getTileEntity(posX, posY, posZ);
if (!(entity instanceof IPipeTile)) {
return;
}
IPipeTile pipeTile = (IPipeTile) entity;
if (!(pipeTile.getPipe() instanceof Pipe)) {
return;
}
Pipe<?> pipe = (Pipe<?>) pipeTile.getPipe();
if (!(pipe.transport instanceof PipeTransportFluids)) {
return;
}
PipeTransportFluids transLiq = (PipeTransportFluids) pipe.transport;
this.largeFluidCapacity = transLiq.getCapacity() > 255;
renderCache = transLiq.renderCache;
byte[] dBytes = new byte[1];
data.readBytes(dBytes);
delta = BitSetUtils.fromByteArray(dBytes);
if (delta.get(0)) {
renderCache.fluidID = data.readShort();
renderCache.color = renderCache.fluidID != 0 ? data.readInt() : 0xFFFFFF;
renderCache.flags = renderCache.fluidID != 0 ? data.readUnsignedByte() : 0;
}
for (ForgeDirection dir : ForgeDirection.values()) {
if (delta.get(dir.ordinal() + 1)) {
renderCache.amount[dir.ordinal()] = Math.min(transLiq.getCapacity(),
largeFluidCapacity ? data.readUnsignedShort() : data.readUnsignedByte());
}
}
}
@Override
public void writeData(ByteBuf data) {
super.writeData(data);
byte[] dBytes = BitSetUtils.toByteArray(delta, 1);
data.writeBytes(dBytes);
if (delta.get(0)) {
data.writeShort(renderCache.fluidID);
if (renderCache.fluidID != 0) {
data.writeInt(renderCache.color);
data.writeByte(renderCache.flags);
}
}
for (ForgeDirection dir : ForgeDirection.values()) {
if (delta.get(dir.ordinal() + 1)) {
if (largeFluidCapacity) {
data.writeShort(renderCache.amount[dir.ordinal()]);
} else {
data.writeByte(renderCache.amount[dir.ordinal()]);
}
}
}
}
@Override
public int getID() {
return PacketIds.PIPE_LIQUID;
}
>>>>>>>
public FluidRenderData renderCache = new FluidRenderData();
public BitSet delta;
private short fluidID = 0;
private int color = 0;
private int[] amount = new int[7];
public byte[] flow = new byte[6];
public PacketFluidUpdate(TileGenericPipe tileG) {
super(tileG);
}
public PacketFluidUpdate(TileGenericPipe tileGP, boolean chunkPacket) {
super(tileGP);
this.isChunkDataPacket = chunkPacket;
}
public PacketFluidUpdate() {}
@Override
public void readData(ByteBuf data) {
super.readData(data);
byte[] dBytes = new byte[1];
data.readBytes(dBytes);
delta = BitSetUtils.fromByteArray(dBytes);
if (delta.get(0)) {
fluidID = data.readShort();
if (fluidID != 0) {
color = data.readInt();
}
}
for (int dir = 0; dir < 7; dir++) {
if (delta.get(dir + 1)) {
amount[dir] = data.readShort();
}
if (dir < 6) {
flow[dir] = data.readByte();
}
}
}
@Override
public void writeData(ByteBuf data) {
super.writeData(data);
byte[] dBytes = BitSetUtils.toByteArray(delta, 1);
data.writeBytes(dBytes);
if (delta.get(0)) {
data.writeShort(renderCache.fluidID);
if (renderCache.fluidID != 0) {
data.writeInt(renderCache.color);
data.writeByte(renderCache.flags);
}
}
for (int dir = 0; dir < 7; dir++) {
if (delta.get(dir + 1)) {
data.writeShort(renderCache.amount[dir]);
}
if (dir < 6) {
data.writeByte(flow[dir]);
}
}
}
@Override
public void applyData(World world, EntityPlayer player) {
if (world.isAirBlock(pos)) {
return;
}
TileEntity entity = world.getTileEntity(pos);
if (!(entity instanceof TileGenericPipe)) {
return;
}
TileGenericPipe pipe = (TileGenericPipe) entity;
if (pipe.pipe == null) {
return;
}
if (!(pipe.pipe.transport instanceof PipeTransportFluids)) {
return;
}
PipeTransportFluids trans = (PipeTransportFluids) pipe.pipe.transport;
// boolean fluidBefore = false;
// boolean fluidAfter = false;
renderCache = trans.renderCache;
renderCache.flow = flow;
// System.out.printf("read %d, %d, %d = %s, %s%n", posX, posY, posZ, Arrays.toString(dBytes), delta);
if (delta.get(0)) {
renderCache.fluidID = fluidID;
Fluid fluid = FluidRegistry.getFluid(fluidID);
if (fluid == null) {
trans.fluidType = null;
} else {
trans.fluidType = new FluidStack(fluid, 1);
}
renderCache.color = color;
}
for (int dir = 0; dir < 7; dir++) {
if (delta.get(dir + 1)) {
// boolean before = renderCache.amount[dir] > 0;
renderCache.amount[dir] = amount[dir];
// boolean after = renderCache.amount[dir] > 0;
// fluidBefore |= before;
// fluidAfter |= after;
}
if (dir < 6) {
trans.clientDisplayFlowConnection[dir] = flow[dir];
}
}
// TODO Fluid shader rendering (unused for now)
// if (fluidBefore && !fluidAfter) {
// FluidShaderManager.INSTANCE.getRenderer(Minecraft.getMinecraft().theWorld).removeFluidTransport(trans);
// }
// if (!fluidBefore && fluidAfter) {
// FluidShaderManager.INSTANCE.getRenderer(Minecraft.getMinecraft().theWorld).addFluidTransport(trans);
// }
} |
<<<<<<<
liquidToExtract -= transport.getFlowRate();
=======
liquidToExtract -= transport.flowRate;
if (liquidToExtract < 0) {
liquidToExtract = 0;
}
>>>>>>>
liquidToExtract -= transport.getFlowRate();
if (liquidToExtract < 0) {
liquidToExtract = 0;
} |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
private int waitedCycles = 0;
private IFluidFilter filter;
public AIRobotLoadFluids(EntityRobotBase iRobot) {
super(iRobot);
}
public AIRobotLoadFluids(EntityRobotBase iRobot, IFluidFilter iFilter) {
this(iRobot);
filter = iFilter;
setSuccess(false);
}
@Override
public void update() {
waitedCycles++;
if (waitedCycles > 40) {
if (load(robot, robot.getDockingStation(), filter, true) == 0) {
terminate();
} else {
setSuccess(true);
waitedCycles = 0;
}
}
}
public static int load(EntityRobotBase robot, DockingStation station, IFluidFilter filter, boolean doLoad) {
if (station == null) {
return 0;
}
if (!ActionRobotFilter.canInteractWithFluid(station, filter, ActionStationProvideFluids.class)) {
return 0;
}
IFluidHandler handler = station.getFluidInput();
if (handler == null) {
return 0;
}
FluidStack drainable = handler.drain(station.side, FluidContainerRegistry.BUCKET_VOLUME, false);
if (drainable == null || !filter.matches(drainable.getFluid())) {
return 0;
}
drainable = drainable.copy();
int filled = robot.fill(null, drainable, doLoad);
if (filled > 0 && doLoad) {
drainable.amount = filled;
handler.drain(station.side, drainable, true);
}
return filled;
}
@Override
public int getEnergyCost() {
return 8;
}
=======
private int waitedCycles = 0;
private IFluidFilter filter;
public AIRobotLoadFluids(EntityRobotBase iRobot) {
super(iRobot);
}
public AIRobotLoadFluids(EntityRobotBase iRobot, IFluidFilter iFilter) {
this(iRobot);
filter = iFilter;
setSuccess(false);
}
@Override
public void update() {
if (filter == null) {
terminate();
return;
}
waitedCycles++;
if (waitedCycles > 40) {
if (load(robot, robot.getDockingStation(), filter, true) == 0) {
terminate();
} else {
setSuccess(true);
waitedCycles = 0;
}
}
}
public static int load(EntityRobotBase robot, DockingStation station, IFluidFilter filter,
boolean doLoad) {
if (station == null) {
return 0;
}
if (!ActionRobotFilter.canInteractWithFluid(station, filter,
ActionStationProvideFluids.class)) {
return 0;
}
IFluidHandler handler = station.getFluidInput();
if (handler == null) {
return 0;
}
ForgeDirection side = station.getFluidInputSide();
FluidStack drainable = handler.drain(side, FluidContainerRegistry.BUCKET_VOLUME,
false);
if (drainable == null || !filter.matches(drainable.getFluid())) {
return 0;
}
drainable = drainable.copy();
int filled = robot.fill(ForgeDirection.UNKNOWN, drainable, doLoad);
if (filled > 0 && doLoad) {
drainable.amount = filled;
handler.drain(side, drainable, true);
}
return filled;
}
@Override
public int getEnergyCost() {
return 8;
}
>>>>>>>
private int waitedCycles = 0;
private IFluidFilter filter;
public AIRobotLoadFluids(EntityRobotBase iRobot) {
super(iRobot);
}
public AIRobotLoadFluids(EntityRobotBase iRobot, IFluidFilter iFilter) {
this(iRobot);
filter = iFilter;
setSuccess(false);
}
@Override
public void update() {
if (filter == null) {
terminate();
return;
}
waitedCycles++;
if (waitedCycles > 40) {
if (load(robot, robot.getDockingStation(), filter, true) == 0) {
terminate();
} else {
setSuccess(true);
waitedCycles = 0;
}
}
}
public static int load(EntityRobotBase robot, DockingStation station, IFluidFilter filter, boolean doLoad) {
if (station == null) {
return 0;
}
if (!ActionRobotFilter.canInteractWithFluid(station, filter, ActionStationProvideFluids.class)) {
return 0;
}
IFluidHandler handler = station.getFluidInput();
if (handler == null) {
return 0;
}
EnumFacing side = station.getFluidInputSide().face;
FluidStack drainable = handler.drain(side, FluidContainerRegistry.BUCKET_VOLUME, false);
if (drainable == null || !filter.matches(drainable.getFluid())) {
return 0;
}
drainable = drainable.copy();
int filled = robot.fill(null, drainable, doLoad);
if (filled > 0 && doLoad) {
drainable.amount = filled;
handler.drain(side, drainable, true);
}
return filled;
}
@Override
public int getEnergyCost() {
return 8;
} |
<<<<<<<
=======
import buildcraft.core.proxy.CoreProxy;
>>>>>>>
<<<<<<<
import net.minecraftforge.common.DimensionManager;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.transport.TileGenericPipe;
public class PacketHandler extends BuildCraftChannelHandler {
=======
@Sharable
public class PacketHandler extends SimpleChannelInboundHandler<BuildCraftPacket> {
>>>>>>>
import buildcraft.core.proxy.CoreProxy;
@Sharable
public class PacketHandler extends SimpleChannelInboundHandler<BuildCraftPacket> {
<<<<<<<
public void decodeInto(ChannelHandlerContext ctx, ByteBuf data, BuildCraftPacket packet) {
super.decodeInto(ctx, data, packet);
=======
protected void channelRead0(ChannelHandlerContext ctx, BuildCraftPacket packet) {
>>>>>>>
protected void channelRead0(ChannelHandlerContext ctx, BuildCraftPacket packet) { |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ |
<<<<<<<
=======
>>>>>>>
<<<<<<<
import buildcraft.core.utils.StringUtils;
=======
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.triggers.ActionMachineControl.Mode;
>>>>>>>
<<<<<<<
IInventory inv = InvUtils.getInventory(inventory);
ItemStack result = checkExtractGeneric(inv, doRemove, from);
// check through every filter once if non-blocking
if (doRemove
&& stateController.getButtonState() == ButtonState.NONBLOCKING
&& result == null) {
int count = 1;
while (result == null && count < filters.getSizeInventory()) {
incrementFilter();
result = checkExtractGeneric(inv, doRemove, from);
count++;
}
}
if (result != null) {
return new ItemStack[] { result };
=======
if (inventory == null)
return null;
if (inventory instanceof ISpecialInventory) {
return checkExtractSpecialInventory((ISpecialInventory) inventory, doRemove, from);
>>>>>>>
if (inventory == null) {
return null; |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
private final PipeItemsEmerald pipe;
private final IInventory filterInv;
public ContainerEmeraldPipe(EntityPlayer player, PipeItemsEmerald pipe) {
super(player, pipe.getFilters().getSizeInventory());
this.pipe = pipe;
this.filterInv = pipe.getFilters();
for (int i = 0; i < 9; i++) {
addSlotToContainer(new SlotPhantom(filterInv, i, 8 + i * 18, 18));
}
for (int l = 0; l < 3; l++) {
for (int k1 = 0; k1 < 9; k1++) {
addSlotToContainer(new Slot(player.inventory, k1 + l * 9 + 9, 8 + k1 * 18, 79 + l * 18));
}
}
for (int i1 = 0; i1 < 9; i1++) {
addSlotToContainer(new Slot(player.inventory, i1, 8 + i1 * 18, 137));
}
}
@Override
public boolean canInteractWith(EntityPlayer entityplayer) {
return pipe.container.isUseableByPlayer(entityplayer);
}
=======
private final PipeItemsEmerald pipe;
private final IInventory filterInv;
public ContainerEmeraldPipe(IInventory playerInventory, PipeItemsEmerald pipe) {
super(pipe.getFilters().getSizeInventory());
this.pipe = pipe;
this.filterInv = pipe.getFilters();
for (int i = 0; i < 9; i++) {
addSlotToContainer(new SlotPhantom(filterInv, i, 8 + i * 18, 18));
}
for (int l = 0; l < 3; l++) {
for (int k1 = 0; k1 < 9; k1++) {
addSlotToContainer(new Slot(playerInventory, k1 + l * 9 + 9, 8 + k1 * 18, 79 + l * 18));
}
}
for (int i1 = 0; i1 < 9; i1++) {
addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 137));
}
}
@Override
public boolean canInteractWith(EntityPlayer entityplayer) {
return pipe.container.isUseableByPlayer(entityplayer);
}
>>>>>>>
private final PipeItemsEmerald pipe;
private final IInventory filterInv;
public ContainerEmeraldPipe(EntityPlayer player, PipeItemsEmerald pipe) {
super(player, pipe.getFilters().getSizeInventory());
this.pipe = pipe;
this.filterInv = pipe.getFilters();
for (int i = 0; i < 9; i++) {
addSlotToContainer(new SlotPhantom(filterInv, i, 8 + i * 18, 18));
}
for (int l = 0; l < 3; l++) {
for (int k1 = 0; k1 < 9; k1++) {
addSlotToContainer(new Slot(player.inventory, k1 + l * 9 + 9, 8 + k1 * 18, 79 + l * 18));
}
}
for (int i1 = 0; i1 < 9; i1++) {
addSlotToContainer(new Slot(player.inventory, i1, 8 + i1 * 18, 137));
}
}
@Override
public boolean canInteractWith(EntityPlayer entityplayer) {
return pipe.container.isUseableByPlayer(entityplayer);
} |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
public boolean iterating;
private final Set<TravelingItem> items = Sets.newConcurrentHashSet();
private final Set<TravelingItem> toLoad = Sets.newConcurrentHashSet();
private final Set<TravelingItem> toAdd = Sets.newConcurrentHashSet();
private final Set<TravelingItem> toRemove = Sets.newConcurrentHashSet();
private int delay = 0;
private final PipeTransportItems transport;
public TravelerSet(PipeTransportItems transport) {
this.transport = transport;
}
@Override
protected Set<TravelingItem> delegate() {
return items;
}
@Override
public boolean add(TravelingItem item) {
if (iterating) {
return toAdd.add(item);
}
item.setContainer(transport.container);
items.add(item);
return true;
}
@Override
public boolean addAll(Collection<? extends TravelingItem> collection) {
if (iterating) {
return toAdd.addAll(collection);
}
return standardAddAll(collection);
}
@Override
public boolean remove(Object object) {
if (iterating) {
return toRemove.add((TravelingItem) object);
}
return delegate().remove(object);
}
@Override
public boolean removeAll(Collection<?> collection) {
throw new UnsupportedOperationException();
}
@Override
public boolean retainAll(Collection<?> collection) {
throw new UnsupportedOperationException();
}
void scheduleLoad(TravelingItem item) {
delay = 10;
toLoad.add(item);
}
private void loadScheduledItems() {
if (delay > 0) {
delay--;
return;
}
addAll(toLoad);
toLoad.clear();
}
private void addScheduledItems() {
addAll(toAdd);
toAdd.clear();
}
public boolean scheduleRemoval(TravelingItem item) {
return toRemove.add(item);
}
public boolean unscheduleRemoval(TravelingItem item) {
return toRemove.remove(item);
}
void removeScheduledItems() {
items.removeAll(toRemove);
toRemove.clear();
}
void flush() {
loadScheduledItems();
addScheduledItems();
removeScheduledItems();
}
@Override
public Iterator<TravelingItem> iterator() {
return items.iterator();
}
@Override
public void clear() {
if (iterating) {
toRemove.addAll(this);
} else {
items.clear();
}
}
=======
public boolean iterating;
private final Set<TravelingItem> items = new HashSet<TravelingItem>();
private final Set<TravelingItem> toLoad = new HashSet<TravelingItem>();
private final Set<TravelingItem> toAdd = new HashSet<TravelingItem>();
private final Set<TravelingItem> toRemove = new HashSet<TravelingItem>();
private int delay = 0;
private final PipeTransportItems transport;
public TravelerSet(PipeTransportItems transport) {
this.transport = transport;
}
@Override
protected Set<TravelingItem> delegate() {
return items;
}
@Override
public boolean add(TravelingItem item) {
if (iterating) {
return toAdd.add(item);
}
item.setContainer(transport.container);
items.add(item);
return true;
}
@Override
public boolean addAll(Collection<? extends TravelingItem> collection) {
if (iterating) {
return toAdd.addAll(collection);
}
return standardAddAll(collection);
}
@Override
public boolean remove(Object object) {
if (iterating) {
return toRemove.add((TravelingItem) object);
}
return delegate().remove(object);
}
@Override
public boolean removeAll(Collection<?> collection) {
throw new UnsupportedOperationException();
}
@Override
public boolean retainAll(Collection<?> collection) {
throw new UnsupportedOperationException();
}
void scheduleLoad(TravelingItem item) {
delay = 10;
toLoad.add(item);
}
private void loadScheduledItems() {
if (delay > 0) {
delay--;
return;
}
addAll(toLoad);
toLoad.clear();
}
private void addScheduledItems() {
addAll(toAdd);
toAdd.clear();
}
public boolean scheduleRemoval(TravelingItem item) {
return toRemove.add(item);
}
public boolean unscheduleRemoval(TravelingItem item) {
return toRemove.remove(item);
}
void removeScheduledItems() {
for (TravelingItem i : toRemove) {
i.cleanup();
items.remove(i);
}
toRemove.clear();
}
void flush() {
loadScheduledItems();
addScheduledItems();
removeScheduledItems();
}
@Override
public Iterator<TravelingItem> iterator() {
return items.iterator();
}
@Override
public void clear() {
if (iterating) {
toRemove.addAll(this);
} else {
items.clear();
}
}
>>>>>>>
public boolean iterating;
private final Set<TravelingItem> items = Sets.newConcurrentHashSet();
private final Set<TravelingItem> toLoad = Sets.newConcurrentHashSet();
private final Set<TravelingItem> toAdd = Sets.newConcurrentHashSet();
private final Set<TravelingItem> toRemove = Sets.newConcurrentHashSet();
private int delay = 0;
private final PipeTransportItems transport;
public TravelerSet(PipeTransportItems transport) {
this.transport = transport;
}
@Override
protected Set<TravelingItem> delegate() {
return items;
}
@Override
public boolean add(TravelingItem item) {
if (iterating) {
return toAdd.add(item);
}
item.setContainer(transport.container);
items.add(item);
return true;
}
@Override
public boolean addAll(Collection<? extends TravelingItem> collection) {
if (iterating) {
return toAdd.addAll(collection);
}
return standardAddAll(collection);
}
@Override
public boolean remove(Object object) {
if (iterating) {
return toRemove.add((TravelingItem) object);
}
return delegate().remove(object);
}
@Override
public boolean removeAll(Collection<?> collection) {
throw new UnsupportedOperationException();
}
@Override
public boolean retainAll(Collection<?> collection) {
throw new UnsupportedOperationException();
}
void scheduleLoad(TravelingItem item) {
delay = 10;
toLoad.add(item);
}
private void loadScheduledItems() {
if (delay > 0) {
delay--;
return;
}
addAll(toLoad);
toLoad.clear();
}
private void addScheduledItems() {
addAll(toAdd);
toAdd.clear();
}
public boolean scheduleRemoval(TravelingItem item) {
return toRemove.add(item);
}
public boolean unscheduleRemoval(TravelingItem item) {
return toRemove.remove(item);
}
void removeScheduledItems() {
for (TravelingItem i : toRemove) {
i.cleanup();
items.remove(i);
}
toRemove.clear();
}
void flush() {
loadScheduledItems();
addScheduledItems();
removeScheduledItems();
}
@Override
public Iterator<TravelingItem> iterator() {
return items.iterator();
}
@Override
public void clear() {
if (iterating) {
toRemove.addAll(this);
} else {
items.clear();
}
} |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
=======
import net.minecraft.client.renderer.texture.IIconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
>>>>>>>
<<<<<<<
public enum PipeContents {
empty,
containsItems,
containsFluids,
containsEnergy,
requestsEnergy,
tooMuchEnergy;
public ITriggerInternal trigger;
}
private PipeContents kind;
public TriggerPipeContents(PipeContents kind) {
super("buildcraft:pipe.contents." + kind.name().toLowerCase(Locale.ROOT), "buildcraft.pipe.contents." + kind.name());
setBuildCraftLocation("transport", "triggers/trigger_pipecontents_" + kind.name().toLowerCase(Locale.ROOT));
this.kind = kind;
kind.trigger = this;
}
@Override
public int maxParameters() {
switch (kind) {
case containsItems:
case containsFluids:
return 1;
default:
return 0;
}
}
@Override
public String getDescription() {
return StringUtils.localize("gate.trigger.pipe." + kind.name());
}
@Override
public boolean isTriggerActive(IStatementContainer container, IStatementParameter[] parameters) {
if (!(container instanceof IGate)) {
return false;
}
Pipe<?> pipe = (Pipe<?>) ((IGate) container).getPipe();
IStatementParameter parameter = parameters[0];
if (pipe.transport instanceof PipeTransportItems) {
PipeTransportItems transportItems = (PipeTransportItems) pipe.transport;
if (kind == PipeContents.empty) {
return transportItems.items.isEmpty();
} else if (kind == PipeContents.containsItems) {
if (parameter != null && parameter.getItemStack() != null) {
for (TravelingItem item : transportItems.items) {
if (StackHelper.isMatchingItemOrList(parameter.getItemStack(), item.getItemStack())) {
return true;
}
}
} else {
return !transportItems.items.isEmpty();
}
}
} else if (pipe.transport instanceof PipeTransportFluids) {
PipeTransportFluids transportFluids = (PipeTransportFluids) pipe.transport;
FluidStack searchedFluid = null;
if (parameter != null && parameter.getItemStack() != null) {
searchedFluid = FluidContainerRegistry.getFluidForFilledItem(parameter.getItemStack());
}
if (kind == PipeContents.empty) {
for (FluidTankInfo b : transportFluids.getTankInfo(null)) {
if (b.fluid != null && b.fluid.amount != 0) {
return false;
}
}
return true;
} else {
for (FluidTankInfo b : transportFluids.getTankInfo(null)) {
if (b.fluid != null && b.fluid.amount != 0) {
if (searchedFluid == null || searchedFluid.isFluidEqual(b.fluid)) {
return true;
}
}
}
return false;
}
} else if (pipe.transport instanceof PipeTransportPower) {
PipeTransportPower transportPower = (PipeTransportPower) pipe.transport;
switch (kind) {
case empty:
for (double s : transportPower.displayPower) {
if (s > 1e-4) {
return false;
}
}
return true;
case containsEnergy:
for (double s : transportPower.displayPower) {
if (s > 1e-4) {
return true;
}
}
return false;
case requestsEnergy:
return transportPower.isQueryingPower();
default:
case tooMuchEnergy:
return transportPower.isOverloaded();
}
}
return false;
}
@Override
public IStatementParameter createParameter(int index) {
return new StatementParameterItemStack();
}
=======
public enum PipeContents {
empty,
containsItems,
containsFluids,
containsEnergy,
requestsEnergy,
tooMuchEnergy;
public ITriggerInternal trigger;
}
private PipeContents kind;
public TriggerPipeContents(PipeContents kind) {
super("buildcraft:pipe.contents." + kind.name().toLowerCase(Locale.ENGLISH), "buildcraft.pipe.contents." + kind.name());
this.kind = kind;
kind.trigger = this;
}
@Override
public int maxParameters() {
switch (kind) {
case containsItems:
case containsFluids:
return 1;
default:
return 0;
}
}
@Override
public String getDescription() {
return StringUtils.localize("gate.trigger.pipe." + kind.name());
}
@Override
public boolean isTriggerActive(IStatementContainer container, IStatementParameter[] parameters) {
if (!(container instanceof IGate)) {
return false;
}
Pipe<?> pipe = (Pipe<?>) ((IGate) container).getPipe();
IStatementParameter parameter = parameters[0];
if (pipe.transport instanceof PipeTransportItems) {
PipeTransportItems transportItems = (PipeTransportItems) pipe.transport;
if (kind == PipeContents.empty) {
return transportItems.items.isEmpty();
} else if (kind == PipeContents.containsItems) {
if (parameter != null && parameter.getItemStack() != null) {
for (TravelingItem item : transportItems.items) {
if (StackHelper.isMatchingItemOrList(parameter.getItemStack(), item.getItemStack())) {
return true;
}
}
} else {
return !transportItems.items.isEmpty();
}
}
} else if (pipe.transport instanceof PipeTransportFluids) {
PipeTransportFluids transportFluids = (PipeTransportFluids) pipe.transport;
if (kind == PipeContents.empty) {
return transportFluids.fluidType == null;
} else {
if (parameter != null && parameter.getItemStack() != null) {
FluidStack searchedFluid = FluidContainerRegistry.getFluidForFilledItem(parameter.getItemStack());
if (searchedFluid != null) {
return transportFluids.fluidType != null && searchedFluid.isFluidEqual(transportFluids.fluidType);
}
} else {
return transportFluids.fluidType != null;
}
}
} else if (pipe.transport instanceof PipeTransportPower) {
PipeTransportPower transportPower = (PipeTransportPower) pipe.transport;
switch (kind) {
case empty:
for (short s : transportPower.displayPower) {
if (s > 0) {
return false;
}
}
return true;
case containsEnergy:
for (short s : transportPower.displayPower) {
if (s > 0) {
return true;
}
}
return false;
case requestsEnergy:
return transportPower.isQueryingPower();
default:
case tooMuchEnergy:
return transportPower.isOverloaded();
}
}
return false;
}
@Override
public IStatementParameter createParameter(int index) {
return new StatementParameterItemStack();
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister) {
icon = iconRegister.registerIcon("buildcrafttransport:triggers/trigger_pipecontents_" + kind.name().toLowerCase(Locale.ENGLISH));
}
>>>>>>>
public enum PipeContents {
empty,
containsItems,
containsFluids,
containsEnergy,
requestsEnergy,
tooMuchEnergy;
public ITriggerInternal trigger;
}
private PipeContents kind;
public TriggerPipeContents(PipeContents kind) {
super("buildcraft:pipe.contents." + kind.name().toLowerCase(Locale.ROOT), "buildcraft.pipe.contents." + kind.name());
setBuildCraftLocation("transport", "triggers/trigger_pipecontents_" + kind.name().toLowerCase(Locale.ROOT));
this.kind = kind;
kind.trigger = this;
}
@Override
public int maxParameters() {
switch (kind) {
case containsItems:
case containsFluids:
return 1;
default:
return 0;
}
}
@Override
public String getDescription() {
return StringUtils.localize("gate.trigger.pipe." + kind.name());
}
@Override
public boolean isTriggerActive(IStatementContainer container, IStatementParameter[] parameters) {
if (!(container instanceof IGate)) {
return false;
}
Pipe<?> pipe = (Pipe<?>) ((IGate) container).getPipe();
IStatementParameter parameter = parameters[0];
if (pipe.transport instanceof PipeTransportItems) {
PipeTransportItems transportItems = (PipeTransportItems) pipe.transport;
if (kind == PipeContents.empty) {
return transportItems.items.isEmpty();
} else if (kind == PipeContents.containsItems) {
if (parameter != null && parameter.getItemStack() != null) {
for (TravelingItem item : transportItems.items) {
if (StackHelper.isMatchingItemOrList(parameter.getItemStack(), item.getItemStack())) {
return true;
}
}
} else {
return !transportItems.items.isEmpty();
}
}
} else if (pipe.transport instanceof PipeTransportFluids) {
PipeTransportFluids transportFluids = (PipeTransportFluids) pipe.transport;
if (kind == PipeContents.empty) {
return transportFluids.fluidType == null;
} else {
if (parameter != null && parameter.getItemStack() != null) {
FluidStack searchedFluid = FluidContainerRegistry.getFluidForFilledItem(parameter.getItemStack());
if (searchedFluid != null) {
return transportFluids.fluidType != null && searchedFluid.isFluidEqual(transportFluids.fluidType);
}
} else {
return transportFluids.fluidType != null;
}
}
} else if (pipe.transport instanceof PipeTransportPower) {
PipeTransportPower transportPower = (PipeTransportPower) pipe.transport;
switch (kind) {
case empty:
for (short s : transportPower.displayPower) {
if (s > 0) {
return false;
}
}
return true;
case containsEnergy:
for (short s : transportPower.displayPower) {
if (s > 0) {
return true;
}
}
return false;
case requestsEnergy:
return transportPower.isQueryingPower();
default:
case tooMuchEnergy:
return transportPower.isOverloaded();
}
}
return false;
}
@Override
public IStatementParameter createParameter(int index) {
return new StatementParameterItemStack();
} |
<<<<<<<
public static final Logger logger = LogManager.getLogger("BuildCraft");
/** Deactivate constructor */
private BCLog() {}
public static void initLog() {
logger.info("Starting BuildCraft " + getVersion());
logger.info("Copyright (c) SpaceToad, 2011-2015");
logger.info("http://www.mod-buildcraft.com");
}
public static void logErrorAPI(String mod, Throwable error, Class<?> classFile) {
StringBuilder msg = new StringBuilder(mod);
msg.append(" API error, please update your mods. Error: ").append(error);
StackTraceElement[] stackTrace = error.getStackTrace();
if (stackTrace.length > 0) {
msg.append(", ").append(stackTrace[0]);
}
logger.log(Level.ERROR, msg.toString());
if (classFile != null) {
msg = new StringBuilder(mod);
msg.append(" API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain()
.getCodeSource().getLocation());
logger.log(Level.ERROR, msg.toString());
}
}
=======
public static final Logger logger = LogManager.getLogger("BuildCraft");
private BCLog() {
}
@Deprecated
public static void logErrorAPI(String mod, Throwable error, Class<?> classFile) {
logErrorAPI(error, classFile);
}
public static void logErrorAPI(Throwable error, Class<?> classFile) {
StringBuilder msg = new StringBuilder("API error! Please update your mods. Error: ");
msg.append(error);
StackTraceElement[] stackTrace = error.getStackTrace();
if (stackTrace.length > 0) {
msg.append(", ").append(stackTrace[0]);
}
logger.log(Level.ERROR, msg.toString());
if (classFile != null) {
msg.append("API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain().getCodeSource().getLocation());
logger.log(Level.ERROR, msg.toString());
}
}
>>>>>>>
public static final Logger logger = LogManager.getLogger("BuildCraft");
/** Deactivate constructor */
private BCLog() {} |
<<<<<<<
public class PipeEventBus implements IEventBus<PipeEvent> {
public enum Provider implements IEventBusProvider<PipeEvent> {
INSTANCE;
@Override
public IEventBus<PipeEvent> newBus() {
return new PipeEventBus();
}
}
private class EventHandler {
public Method method;
public Object owner;
public EventHandler(Method m, Object o) {
this.method = m;
this.owner = o;
}
@Override
public boolean equals(Object o) {
if (o == null || !(o instanceof EventHandler)) {
return false;
}
EventHandler e = (EventHandler) o;
return e.method.equals(method) && e.owner == owner;
}
}
private static class EventHandlerCompare implements Comparator<EventHandler> {
private int getPriority(EventHandler eh) {
PipeEventPriority p = eh.method.getAnnotation(PipeEventPriority.class);
return p != null ? p.priority() : 0;
}
@Override
public int compare(EventHandler o1, EventHandler o2) {
int priority1 = getPriority(o1);
int priority2 = getPriority(o2);
return priority2 - priority1;
}
}
private static final EventHandlerCompare COMPARATOR = new EventHandlerCompare();
private static final HashSet<Object> globalHandlers = new HashSet<Object>();
private final HashSet<Object> registeredHandlers = new HashSet<Object>();
private final HashMap<Object, Map<Method, Class<? extends PipeEvent>>> handlerMethods = Maps.newHashMap();
private final HashMap<Class<? extends PipeEvent>, List<EventHandler>> eventHandlers = Maps.newHashMap();
public PipeEventBus() {
for (Object o : globalHandlers) {
registerHandler(o);
}
}
public static void registerGlobalHandler(Object globalHandler) {
globalHandlers.add(globalHandler);
}
private List<EventHandler> getHandlerList(Class<? extends PipeEvent> event) {
if (!eventHandlers.containsKey(event)) {
eventHandlers.put(event, new ArrayList<EventHandler>());
}
return eventHandlers.get(event);
}
@Override
public void registerHandler(Object handler) {
if (registeredHandlers.contains(handler)) {
return;
}
registeredHandlers.add(handler);
Map<Method, Class<? extends PipeEvent>> methods = new HashMap<Method, Class<? extends PipeEvent>>();
for (Method m : handler.getClass().getDeclaredMethods()) {
if ("eventHandler".equals(m.getName())) {
Class[] parameters = m.getParameterTypes();
if (parameters.length == 1 && PipeEvent.class.isAssignableFrom(parameters[0])) {
Class<? extends PipeEvent> eventType = (Class<? extends PipeEvent>) parameters[0];
List<EventHandler> eventHandlerList = getHandlerList(eventType);
eventHandlerList.add(new EventHandler(m, handler));
updateEventHandlers(eventHandlerList);
methods.put(m, eventType);
// BCPipeEventHandler annotation = m.getAnnotation(BCPipeEventHandler.class);
// if (annotation == null) BCLog.logger.warn("Need to add @BCPipeEventHandler to the method " + m);
}
}
}
handlerMethods.put(handler, methods);
}
private void updateEventHandlers(List<EventHandler> eventHandlerList) {
Collections.sort(eventHandlerList, COMPARATOR);
}
@Override
public void unregisterHandler(Object handler) {
if (!registeredHandlers.contains(handler)) {
return;
}
registeredHandlers.remove(handler);
Map<Method, Class<? extends PipeEvent>> methodMap = handlerMethods.get(handler);
for (Method m : methodMap.keySet()) {
getHandlerList(methodMap.get(m)).remove(new EventHandler(m, handler));
}
handlerMethods.remove(handler);
}
@Override
public void handleEvent(PipeEvent event) {
for (EventHandler eventHandler : getHandlerList(event.getClass())) {
try {
eventHandler.method.invoke(eventHandler.owner, event);
} catch (Exception e) {
}
}
}
=======
public class PipeEventBus {
private class EventHandler {
public Method method;
public Object owner;
public EventHandler(Method m, Object o) {
this.method = m;
this.owner = o;
}
@Override
public boolean equals(Object o) {
if (o == null || !(o instanceof EventHandler)) {
return false;
}
EventHandler e = (EventHandler) o;
return e.method.equals(method) && e.owner == owner;
}
}
private static class EventHandlerCompare implements Comparator<EventHandler> {
private int getPriority(EventHandler eh) {
PipeEventPriority p = eh.method.getAnnotation(PipeEventPriority.class);
return p != null ? p.priority() : 0;
}
@Override
public int compare(EventHandler o1, EventHandler o2) {
int priority1 = getPriority(o1);
int priority2 = getPriority(o2);
return priority2 - priority1;
}
}
private static final EventHandlerCompare COMPARATOR = new EventHandlerCompare();
private static final HashSet<Object> globalHandlers = new HashSet<Object>();
private final HashSet<Object> registeredHandlers = new HashSet<Object>();
private final HashMap<Object, Map<Method, Class<? extends PipeEvent>>> handlerMethods = new HashMap<Object, Map<Method, Class<? extends PipeEvent>>>();
private final HashMap<Class<? extends PipeEvent>, List<EventHandler>> eventHandlers = new HashMap<Class<? extends PipeEvent>, List<EventHandler>>();
public PipeEventBus() {
for (Object o : globalHandlers) {
registerHandler(o);
}
}
public static void registerGlobalHandler(Object globalHandler) {
globalHandlers.add(globalHandler);
}
private List<EventHandler> getHandlerList(Class<? extends PipeEvent> event) {
if (!eventHandlers.containsKey(event)) {
eventHandlers.put(event, new ArrayList<EventHandler>());
}
return eventHandlers.get(event);
}
public void registerHandler(Object handler) {
if (registeredHandlers.contains(handler)) {
return;
}
registeredHandlers.add(handler);
Map<Method, Class<? extends PipeEvent>> methods = new HashMap<Method, Class<? extends PipeEvent>>();
for (Method m : handler.getClass().getDeclaredMethods()) {
if ("eventHandler".equals(m.getName())) {
Class<?>[] parameters = m.getParameterTypes();
if (parameters.length == 1 && PipeEvent.class.isAssignableFrom(parameters[0])) {
Class<? extends PipeEvent> eventType = (Class<? extends PipeEvent>) parameters[0];
List<EventHandler> eventHandlerList = getHandlerList(eventType);
eventHandlerList.add(new EventHandler(m, handler));
updateEventHandlers(eventHandlerList);
methods.put(m, eventType);
}
}
}
handlerMethods.put(handler, methods);
}
private void updateEventHandlers(List<EventHandler> eventHandlerList) {
Collections.sort(eventHandlerList, COMPARATOR);
}
public void unregisterHandler(Object handler) {
if (!registeredHandlers.contains(handler)) {
return;
}
registeredHandlers.remove(handler);
Map<Method, Class<? extends PipeEvent>> methodMap = handlerMethods.get(handler);
for (Method m : methodMap.keySet()) {
getHandlerList(methodMap.get(m)).remove(new EventHandler(m, handler));
}
handlerMethods.remove(handler);
}
public void handleEvent(Class<? extends PipeEvent> eventClass, PipeEvent event) {
for (EventHandler eventHandler : getHandlerList(eventClass)) {
try {
eventHandler.method.invoke(eventHandler.owner, event);
} catch (Exception e) {
}
}
}
>>>>>>>
public class PipeEventBus implements IEventBus<PipeEvent> {
public enum Provider implements IEventBusProvider<PipeEvent> {
INSTANCE;
@Override
public IEventBus<PipeEvent> newBus() {
return new PipeEventBus();
}
}
private class EventHandler {
public Method method;
public Object owner;
public EventHandler(Method m, Object o) {
this.method = m;
this.owner = o;
}
@Override
public boolean equals(Object o) {
if (o == null || !(o instanceof EventHandler)) {
return false;
}
EventHandler e = (EventHandler) o;
return e.method.equals(method) && e.owner == owner;
}
}
private static class EventHandlerCompare implements Comparator<EventHandler> {
private int getPriority(EventHandler eh) {
PipeEventPriority p = eh.method.getAnnotation(PipeEventPriority.class);
return p != null ? p.priority() : 0;
}
@Override
public int compare(EventHandler o1, EventHandler o2) {
int priority1 = getPriority(o1);
int priority2 = getPriority(o2);
return priority2 - priority1;
}
}
private static final EventHandlerCompare COMPARATOR = new EventHandlerCompare();
private static final HashSet<Object> globalHandlers = new HashSet<Object>();
private final HashSet<Object> registeredHandlers = new HashSet<Object>();
private final HashMap<Object, Map<Method, Class<? extends PipeEvent>>> handlerMethods = Maps.newHashMap();
private final HashMap<Class<? extends PipeEvent>, List<EventHandler>> eventHandlers = Maps.newHashMap();
public PipeEventBus() {
for (Object o : globalHandlers) {
registerHandler(o);
}
}
public static void registerGlobalHandler(Object globalHandler) {
globalHandlers.add(globalHandler);
}
private List<EventHandler> getHandlerList(Class<? extends PipeEvent> event) {
if (!eventHandlers.containsKey(event)) {
eventHandlers.put(event, new ArrayList<EventHandler>());
}
return eventHandlers.get(event);
}
@Override
public void registerHandler(Object handler) {
if (registeredHandlers.contains(handler)) {
return;
}
registeredHandlers.add(handler);
Map<Method, Class<? extends PipeEvent>> methods = new HashMap<Method, Class<? extends PipeEvent>>();
for (Method m : handler.getClass().getDeclaredMethods()) {
if ("eventHandler".equals(m.getName())) {
Class<?>[] parameters = m.getParameterTypes();
if (parameters.length == 1 && PipeEvent.class.isAssignableFrom(parameters[0])) {
Class<? extends PipeEvent> eventType = (Class<? extends PipeEvent>) parameters[0];
List<EventHandler> eventHandlerList = getHandlerList(eventType);
eventHandlerList.add(new EventHandler(m, handler));
updateEventHandlers(eventHandlerList);
methods.put(m, eventType);
// BCPipeEventHandler annotation = m.getAnnotation(BCPipeEventHandler.class);
// if (annotation == null) BCLog.logger.warn("Need to add @BCPipeEventHandler to the method " + m);
}
}
}
handlerMethods.put(handler, methods);
}
private void updateEventHandlers(List<EventHandler> eventHandlerList) {
Collections.sort(eventHandlerList, COMPARATOR);
}
@Override
public void unregisterHandler(Object handler) {
if (!registeredHandlers.contains(handler)) {
return;
}
registeredHandlers.remove(handler);
Map<Method, Class<? extends PipeEvent>> methodMap = handlerMethods.get(handler);
for (Method m : methodMap.keySet()) {
getHandlerList(methodMap.get(m)).remove(new EventHandler(m, handler));
}
handlerMethods.remove(handler);
}
@Override
public void handleEvent(PipeEvent event) {
for (EventHandler eventHandler : getHandlerList(event.getClass())) {
try {
eventHandler.method.invoke(eventHandler.owner, event);
} catch (Exception e) {
}
}
} |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
=======
import net.minecraftforge.common.util.ForgeDirection;
>>>>>>>
<<<<<<<
@Override
public StripesHandlerType getType() {
return StripesHandlerType.ITEM_USE;
}
@Override
public boolean shouldHandle(ItemStack stack) {
return true;
}
@Override
public boolean handle(World world, BlockPos pos, EnumFacing direction, ItemStack stack, EntityPlayer player, IStripesActivator activator) {
AxisAlignedBB box = new AxisAlignedBB(pos, pos.add(1, 1, 1));
List entities = world.getEntitiesWithinAABBExcludingEntity(null, box);
if (entities.size() <= 0) {
return false;
}
List<EntityLivingBase> livingEntities = new LinkedList<EntityLivingBase>();
for (Object entityObj : entities) {
if (entityObj instanceof EntityLivingBase) {
livingEntities.add((EntityLivingBase) entityObj);
}
}
player.setCurrentItemOrArmor(0, stack);
boolean successful = false;
Collections.shuffle(livingEntities);
while (livingEntities.size() > 0) {
EntityLivingBase entity = livingEntities.remove(0);
if (!player.interactWith(entity)) {
continue;
}
successful = true;
dropItemsExcept(stack, player, activator, direction);
}
if (stack.stackSize > 0 && successful) {
activator.sendItem(stack, direction.getOpposite());
}
player.setCurrentItemOrArmor(0, null);
return successful;
}
private void dropItemsExcept(ItemStack stack, EntityPlayer player, IStripesActivator activator, EnumFacing direction) {
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
ItemStack invStack = player.inventory.getStackInSlot(i);
if (invStack != null && invStack != stack) {
player.inventory.setInventorySlotContents(i, null);
activator.sendItem(invStack, direction.getOpposite());
}
}
}
=======
@Override
public StripesHandlerType getType() {
return StripesHandlerType.ITEM_USE;
}
@Override
public boolean shouldHandle(ItemStack stack) {
return true;
}
@Override
public boolean handle(World world, int x, int y, int z,
ForgeDirection direction, ItemStack stack, EntityPlayer player,
IStripesActivator activator) {
AxisAlignedBB box = AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
List<?> entities = world.getEntitiesWithinAABBExcludingEntity(null, box);
if (entities.size() <= 0) {
return false;
}
List<EntityLivingBase> livingEntities = new LinkedList<EntityLivingBase>();
for (Object entityObj : entities) {
if (entityObj instanceof EntityLivingBase) {
livingEntities.add((EntityLivingBase) entityObj);
}
}
player.setCurrentItemOrArmor(0, stack);
boolean successful = false;
Collections.shuffle(livingEntities);
while (livingEntities.size() > 0) {
EntityLivingBase entity = livingEntities.remove(0);
if (!player.interactWith(entity)) {
continue;
}
successful = true;
dropItemsExcept(stack, player, activator, direction);
}
if (stack.stackSize > 0 && successful) {
activator.sendItem(stack, direction.getOpposite());
}
player.setCurrentItemOrArmor(0, null);
return successful;
}
private void dropItemsExcept(ItemStack stack, EntityPlayer player, IStripesActivator activator, ForgeDirection direction) {
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
ItemStack invStack = player.inventory.getStackInSlot(i);
if (invStack != null && invStack != stack) {
player.inventory.setInventorySlotContents(i, null);
activator.sendItem(invStack, direction.getOpposite());
}
}
}
>>>>>>>
@Override
public StripesHandlerType getType() {
return StripesHandlerType.ITEM_USE;
}
@Override
public boolean shouldHandle(ItemStack stack) {
return true;
}
@Override
public boolean handle(World world, BlockPos pos, EnumFacing direction, ItemStack stack, EntityPlayer player, IStripesActivator activator) {
AxisAlignedBB box = new AxisAlignedBB(pos, pos.add(1, 1, 1));
List<Entity> entities = world.getEntitiesWithinAABBExcludingEntity(null, box);
if (entities.size() <= 0) {
return false;
}
List<EntityLivingBase> livingEntities = new LinkedList<EntityLivingBase>();
for (Entity entityObj : entities) {
if (entityObj instanceof EntityLivingBase) {
livingEntities.add((EntityLivingBase) entityObj);
}
}
player.setCurrentItemOrArmor(0, stack);
boolean successful = false;
Collections.shuffle(livingEntities);
while (livingEntities.size() > 0) {
EntityLivingBase entity = livingEntities.remove(0);
if (!player.interactWith(entity)) {
continue;
}
successful = true;
dropItemsExcept(stack, player, activator, direction);
}
if (stack.stackSize > 0 && successful) {
activator.sendItem(stack, direction.getOpposite());
}
player.setCurrentItemOrArmor(0, null);
return successful;
}
private void dropItemsExcept(ItemStack stack, EntityPlayer player, IStripesActivator activator, EnumFacing direction) {
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
ItemStack invStack = player.inventory.getStackInSlot(i);
if (invStack != null && invStack != stack) {
player.inventory.setInventorySlotContents(i, null);
activator.sendItem(invStack, direction.getOpposite());
}
}
} |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
=======
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.common.util.ForgeDirection;
>>>>>>>
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import buildcraft.BuildCraftTransport; |
<<<<<<<
this.setYaml(from.getYaml());
this.setShowRawYaml(from.isShowRawYaml());
=======
this.setYamls(from.getYamls());
>>>>>>>
this.setYamls(from.getYamls());
this.setShowRawYaml(from.isShowRawYaml());
<<<<<<<
if (StringUtils.isNotBlank(getYaml()) && isShowRawYaml()) {
=======
for (String yaml : getYamls()) {
>>>>>>>
if (isShowRawYaml()) {
for (String yaml : getYamls()) {
<<<<<<<
.append(getYaml())
.append("\n");
=======
.append(yaml)
.append("\n");
>>>>>>>
.append(yaml)
.append("\n");
} |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
=======
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
>>>>>>>
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
<<<<<<<
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.oredict.OreDictionary;
=======
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
>>>>>>>
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import buildcraft.BuildCraftCore;
<<<<<<<
import buildcraft.BuildCraftCore;
import buildcraft.core.lib.inventory.StackHelper;
=======
>>>>>>>
<<<<<<<
private static final WeakHashMap<ItemStack, StackLine[]> LINE_CACHE = new WeakHashMap<ItemStack, StackLine[]>();
public static class StackLine {
public boolean oreWildcard = false;
public boolean subitemsWildcard = false;
public boolean isOre;
private ItemStack[] stacks = new ItemStack[7];
private ArrayList<ItemStack> ores = new ArrayList<ItemStack>();
private ArrayList<ItemStack> relatedItems = new ArrayList<ItemStack>();
public ItemStack getStack(int index) {
if (index == 0 || (!oreWildcard && !subitemsWildcard)) {
if (index < 7) {
return stacks[index];
} else {
return null;
}
} else if (oreWildcard) {
if (ores.size() >= index) {
return ores.get(index - 1);
} else {
return null;
}
} else {
if (relatedItems.size() >= index) {
return relatedItems.get(index - 1);
} else {
return null;
}
}
}
public void setStack(int slot, ItemStack stack) {
stacks[slot] = stack;
if (stack != null) {
stacks[slot] = stacks[slot].copy();
stacks[slot].stackSize = 1;
}
if (slot == 0) {
relatedItems.clear();
ores.clear();
if (stack == null) {
isOre = false;
} else {
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
setClientPreviewLists();
} else {
isOre = OreDictionary.getOreIDs(stacks[0]).length > 0;
}
}
}
}
public void writeToNBT(NBTTagCompound nbt) {
nbt.setBoolean("ore", oreWildcard);
nbt.setBoolean("sub", subitemsWildcard);
for (int i = 0; i < 7; ++i) {
if (stacks[i] != null) {
NBTTagCompound stackNBT = new NBTTagCompound();
stacks[i].writeToNBT(stackNBT);
nbt.setTag("stacks[" + i + "]", stackNBT);
}
}
}
public void readFromNBT(NBTTagCompound nbt) {
oreWildcard = nbt.getBoolean("ore");
subitemsWildcard = nbt.getBoolean("sub");
for (int i = 0; i < 7; ++i) {
if (nbt.hasKey("stacks[" + i + "]")) {
setStack(i, ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("stacks[" + i + "]")));
}
}
}
private boolean classMatch(Item base, Item matched) {
if (base.getClass() == Item.class) {
return base == matched;
} else if (base.getClass() == matched.getClass()) {
if (base instanceof ItemBlock) {
Block baseBlock = ((ItemBlock) base).block;
Block matchedBlock = ((ItemBlock) matched).block;
if (baseBlock.getClass() == Block.class) {
return baseBlock == matchedBlock;
} else {
return baseBlock.equals(matchedBlock);
}
} else {
return true;
}
} else {
return false;
}
}
private boolean oreMatch(ItemStack base, ItemStack matched) {
int[] oreIds = OreDictionary.getOreIDs(base);
int[] matchesIds = OreDictionary.getOreIDs(matched);
for (int stackId : oreIds) {
for (int matchId : matchesIds) {
if (stackId == matchId) {
return true;
}
}
}
return false;
}
private void setClientPreviewLists() {
Item baseItem = stacks[0].getItem();
int[] oreIds = OreDictionary.getOreIDs(stacks[0]);
isOre = oreIds.length > 0;
for (Object o : Item.itemRegistry) {
Item item = (Item) o;
boolean classMatch = classMatch(baseItem, item);
List list = new LinkedList();
for (CreativeTabs tab : item.getCreativeTabs()) {
item.getSubItems(item, tab, list);
}
if (list.size() > 0) {
for (Object ol : list) {
ItemStack stack = (ItemStack) ol;
if (classMatch && relatedItems.size() <= 7 && !StackHelper.isMatchingItemOrList(stacks[0], stack)) {
relatedItems.add(stack);
}
if (isOre && ores.size() <= 7 && !StackHelper.isMatchingItemOrList(stacks[0], stack) && oreMatch(stacks[0], stack)) {
ores.add(stack);
}
}
}
}
}
public boolean matches(ItemStack item) {
if (subitemsWildcard) {
if (stacks[0] == null) {
return false;
}
return classMatch(stacks[0].getItem(), item.getItem());
} else if (oreWildcard) {
if (stacks[0] == null) {
return false;
}
return oreMatch(stacks[0], item);
} else {
for (ItemStack stack : stacks) {
if (stack != null && StackHelper.isMatchingItem(stack, item, true, false)) {
return true;
}
}
return false;
}
}
}
public ItemList() {
super();
setMaxStackSize(1);
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if (!world.isRemote) {
player.openGui(BuildCraftCore.instance, GuiIds.LIST, world, 0, 0, 0);
}
return stack;
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
NBTTagCompound nbt = NBTUtils.getItemData(stack);
if (nbt.hasKey("label")) {
list.add(nbt.getString("label"));
}
}
public static void saveLine(ItemStack stack, StackLine line, int index) {
NBTTagCompound nbt = NBTUtils.getItemData(stack);
stack.setItemDamage(1);
NBTTagCompound lineNBT = new NBTTagCompound();
line.writeToNBT(lineNBT);
nbt.setTag("line[" + index + "]", lineNBT);
}
public static void saveLabel(ItemStack stack, String text) {
NBTTagCompound nbt = NBTUtils.getItemData(stack);
nbt.setString("label", text);
}
public static StackLine[] getLines(ItemStack stack) {
if (LINE_CACHE.containsKey(stack)) {
return LINE_CACHE.get(stack);
}
StackLine[] result = new StackLine[6];
for (int i = 0; i < 6; ++i) {
result[i] = new StackLine();
}
NBTTagCompound nbt = NBTUtils.getItemData(stack);
if (stack.getItemDamage() == 1) {
for (int i = 0; i < 6; ++i) {
result[i].readFromNBT(nbt.getCompoundTag("line[" + i + "]"));
}
}
LINE_CACHE.put(stack, result);
return result;
}
@Override
public boolean setName(ItemStack stack, String name) {
saveLabel(stack, name);
return true;
}
@Override
public String getName(ItemStack stack) {
return getLabel(stack);
}
@Override
public String getLabel(ItemStack stack) {
return NBTUtils.getItemData(stack).getString("label");
}
@Override
public boolean matches(ItemStack stackList, ItemStack item) {
StackLine[] lines = getLines(stackList);
if (lines != null) {
for (int i = 0; i < lines.length; i++) {
if (lines[i] != null && lines[i].matches(item)) {
return true;
}
}
}
return false;
}
@Override
public void registerModels() {
ModelHelper.registerItemModel(this, 0, "_clean");
ModelHelper.registerItemModel(this, 1, "_used");
}
=======
public ItemList() {
super();
setHasSubtypes(true);
setMaxStackSize(1);
}
@Override
public IIcon getIconIndex(ItemStack stack) {
itemIcon = icons[NBTUtils.getItemData(stack).hasKey("written") ? 1 : 0];
return itemIcon;
}
@Override
public String[] getIconNames() {
return new String[]{"list/clean", "list/used"};
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if (!world.isRemote) {
player.openGui(BuildCraftCore.instance, stack.getItemDamage() == 1 ? GuiIds.LIST_NEW : GuiIds.LIST_OLD, world, 0, 0, 0);
}
return stack;
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
if (stack.getItemDamage() == 0) {
list.add(EnumChatFormatting.DARK_RED + StatCollector.translateToLocal("tip.deprecated"));
}
NBTTagCompound nbt = NBTUtils.getItemData(stack);
if (nbt.hasKey("label")) {
list.add(nbt.getString("label"));
}
}
public static void saveLabel(ItemStack stack, String text) {
NBTTagCompound nbt = NBTUtils.getItemData(stack);
nbt.setString("label", text);
}
@Override
public boolean setName(ItemStack stack, String name) {
saveLabel(stack, name);
return true;
}
@Override
public String getName(ItemStack stack) {
return getLabel(stack);
}
@Override
public String getLabel(ItemStack stack) {
return NBTUtils.getItemData(stack).getString("label");
}
@Override
public boolean matches(ItemStack stackList, ItemStack item) {
if (stackList.getItemDamage() == 1) {
return ListHandlerNew.matches(stackList, item);
} else {
return ListHandlerOld.matches(stackList, item);
}
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List itemList) {
itemList.add(new ItemStack(this, 1, 0)); // TODO: remove
itemList.add(new ItemStack(this, 1, 1));
}
>>>>>>>
public ItemList() {
super();
setHasSubtypes(true);
setMaxStackSize(1);
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if (!world.isRemote) {
player.openGui(BuildCraftCore.instance, stack.getItemDamage() == 1 ? GuiIds.LIST_NEW : GuiIds.LIST_OLD, world, 0, 0, 0);
}
return stack;
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> list, boolean advanced) {
if (stack.getItemDamage() == 0) {
list.add(EnumChatFormatting.DARK_RED + StatCollector.translateToLocal("tip.deprecated"));
}
NBTTagCompound nbt = NBTUtils.getItemData(stack);
if (nbt.hasKey("label")) {
list.add(nbt.getString("label"));
}
}
public static void saveLabel(ItemStack stack, String text) {
NBTTagCompound nbt = NBTUtils.getItemData(stack);
nbt.setString("label", text);
}
@Override
public boolean setName(ItemStack stack, String name) {
saveLabel(stack, name);
return true;
}
@Override
public String getName(ItemStack stack) {
return getLabel(stack);
}
@Override
public String getLabel(ItemStack stack) {
return NBTUtils.getItemData(stack).getString("label");
}
@Override
public boolean matches(ItemStack stackList, ItemStack item) {
if (stackList.getItemDamage() == 1) {
return ListHandlerNew.matches(stackList, item);
} else {
return ListHandlerOld.matches(stackList, item);
}
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> itemList) {
itemList.add(new ItemStack(this, 1, 0)); // TODO: remove
itemList.add(new ItemStack(this, 1, 1));
}
@Override
public void registerModels() {
ModelHelper.registerItemModel(this, 0, "_clean");
ModelHelper.registerItemModel(this, 1, "_used");
} |
<<<<<<<
import org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar;
import org.csanchez.jenkins.plugins.kubernetes.model.SecretEnvVar;
import org.junit.Before;
=======
>>>>>>>
import org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar;
import org.csanchez.jenkins.plugins.kubernetes.model.SecretEnvVar; |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
if (itemStack != null) {
item = itemStack.copy();
} else {
item = null;
}
requester.setRequest(index, itemStack);
((GuiRequester) gui).getContainer().getRequestList();
}
=======
requester.setRequest(index, itemStack);
((GuiRequester) gui).getContainer().getRequestList();
}
>>>>>>>
requester.setRequest(index, itemStack);
((GuiRequester) gui).getContainer().getRequestList();
}
<<<<<<<
requester = iRequester;
playerInventory = player.inventory;
=======
requester = iRequester;
>>>>>>>
requester = iRequester; |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
if (station == null) {
terminate();
} else if (ai instanceof AIRobotGotoBlock) {
startDelegateAI(new AIRobotStraightMoveTo(robot, Utils.convertMiddle(stationIndex).add(Utils.convert(stationSide, 0.5))));
} else {
setSuccess(true);
if (stationSide.getAxis() != Axis.Y) {
robot.aimItemAt(stationIndex.offset(stationSide, 2));
} else {
robot.aimItemAt(MathHelper.floor_float(robot.getAimYaw() / 90f) * 90f + 180f, robot.getAimPitch());
}
robot.dock(station);
terminate();
}
}
=======
if (station == null) {
terminate();
} else if (ai instanceof AIRobotGotoBlock) {
if (ai.success()) {
startDelegateAI(new AIRobotStraightMoveTo(robot,
stationIndex.x + 0.5F + stationSide.offsetX * 0.5F,
stationIndex.y + 0.5F + stationSide.offsetY * 0.5F,
stationIndex.z + 0.5F + stationSide.offsetZ * 0.5F));
} else {
terminate();
}
} else {
setSuccess(true);
if (stationSide.offsetY == 0) {
robot.aimItemAt(stationIndex.x + 2 * stationSide.offsetX, stationIndex.y,
stationIndex.z + 2 * stationSide.offsetZ);
} else {
robot.aimItemAt(MathHelper.floor_float(robot.getAimYaw() / 90f) * 90f + 180f, robot.getAimPitch());
}
robot.dock(station);
terminate();
}
}
>>>>>>>
if (station == null) {
terminate();
} else if (ai instanceof AIRobotGotoBlock) {
if (ai.success()) {
startDelegateAI(new AIRobotStraightMoveTo(robot, Utils.convertMiddle(stationIndex).add(Utils.convert(stationSide, 0.5))));
} else {
terminate();
}
} else {
setSuccess(true);
if (stationSide.getAxis() != Axis.Y) {
robot.aimItemAt(stationIndex.offset(stationSide, 2));
} else {
robot.aimItemAt(MathHelper.floor_float(robot.getAimYaw() / 90f) * 90f + 180f, robot.getAimPitch());
}
robot.dock(station);
terminate();
}
} |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ |
<<<<<<<
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
=======
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
>>>>>>>
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
<<<<<<<
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.fml.client.registry.ClientRegistry;
=======
import cpw.mods.fml.client.registry.ClientRegistry;
>>>>>>>
import net.minecraftforge.fml.client.registry.ClientRegistry;
<<<<<<<
public static TextureAtlasSprite pumpTexture;
@Override
public void initializeTileEntities() {
super.initializeTileEntities();
if (BuildCraftFactory.tankBlock != null) {
ClientRegistry.bindTileEntitySpecialRenderer(TileTank.class, new RenderTank());
}
if (BuildCraftFactory.refineryBlock != null) {
ClientRegistry.bindTileEntitySpecialRenderer(TileRefinery.class, new RenderRefinery());
}
}
@Override
public void initializeEntityRenders() {
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(BuildCraftFactory.refineryBlock), 0, TileRefinery.class);
}
@Override
public EntityResizableCuboid newPumpTube(World w) {
EntityResizableCuboid eb = super.newPumpTube(w);
eb.texture = pumpTexture;
return eb;
}
=======
public static IIcon pumpTexture;
@Override
public void initializeTileEntities() {
super.initializeTileEntities();
if (BuildCraftFactory.tankBlock != null) {
ClientRegistry.bindTileEntitySpecialRenderer(TileTank.class, new RenderTank());
}
if (BuildCraftFactory.refineryBlock != null) {
ClientRegistry.bindTileEntitySpecialRenderer(TileRefinery.class, new RenderRefinery());
RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftFactory.refineryBlock, 0), new RenderRefinery());
}
if (BuildCraftFactory.hopperBlock != null) {
ClientRegistry.bindTileEntitySpecialRenderer(TileHopper.class, new RenderHopper());
RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftFactory.hopperBlock, 0), new RenderHopper());
}
ClientRegistry.bindTileEntitySpecialRenderer(TileMiningWell.class, new RenderLEDTile(BuildCraftFactory.miningWellBlock));
ClientRegistry.bindTileEntitySpecialRenderer(TilePump.class, new RenderLEDTile(BuildCraftFactory.pumpBlock));
}
@Override
public void initializeEntityRenders() {
}
@Override
public EntityBlock newPumpTube(World w) {
EntityBlock eb = super.newPumpTube(w);
eb.setTexture(pumpTexture);
return eb;
}
>>>>>>>
public static TextureAtlasSprite pumpTexture;
@Override
public void initializeTileEntities() {
super.initializeTileEntities();
if (BuildCraftFactory.tankBlock != null) {
ClientRegistry.bindTileEntitySpecialRenderer(TileTank.class, new RenderTank());
}
if (BuildCraftFactory.refineryBlock != null) {
ClientRegistry.bindTileEntitySpecialRenderer(TileRefinery.class, new RenderRefinery());
}
}
@Override
public EntityResizableCuboid newPumpTube(World w) {
EntityResizableCuboid eb = super.newPumpTube(w);
eb.texture = pumpTexture;
return eb;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.