repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
ragdroid/Dahaka
app/src/androidTest/java/com/ragdroid/dahaka/app/TestComponent.java
// Path: app/src/androidTest/java/com/ragdroid/dahaka/DahakaTestApplication.java // public class DahakaTestApplication extends DahakaApplication { // // public TestComponent getTestComponent() { // return testComponent; // } // // private TestComponent testComponent; // // @Override // protected void createComponent() { // testComponent = DaggerTestComponent.builder().application(this).build(); // testComponent.inject(this); // } // // } // // Path: app/src/main/java/com/ragdroid/dahaka/activity/AppBindingModule.java // @Module(subcomponents = UserComponent.class) // public abstract class AppBindingModule { // // @ContributesAndroidInjector(modules = LoginModule.class) // @ActivityScope // abstract LoginActivity loginActivity(); // } // // Path: app/src/androidTest/java/com/ragdroid/dahaka/activity/login/LoginActivityTest.java // @RunWith(AndroidJUnit4.class) // public class LoginActivityTest { // // @Inject // PokemonService service; // // @Inject // TestScheduler testScheduler; // // @Rule // public ActivityTestRule<LoginActivity> activityRule = new ActivityTestRule<>( // LoginActivity.class, true); // // @Before // public void setUp() throws Exception { // Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); // DahakaTestApplication app // = (DahakaTestApplication) instrumentation.getTargetContext().getApplicationContext(); // TestComponent component = (TestComponent) app.getTestComponent(); // component.inject(this); // } // // @Test // public void testOne() throws InterruptedException { // when(service.getPokemon("pikachu")).thenReturn(Single.just(TestDataFactory.getDummyPokemon())); // LoginActivity loginActivity = activityRule.launchActivity(new Intent()); // onView(withId(R.id.login_input)).perform(typeText("pikachu"), closeSoftKeyboard()); // // onView(withId(R.id.login_submit_button)) // .perform(click()); // testScheduler.triggerActions(); // onView(withText("Login Successful")) // .inRoot(withDecorView(not(is(loginActivity.getWindow().getDecorView())))) // .check(matches(isDisplayed())); // // // } // // } // // Path: app/src/androidTest/java/com/ragdroid/dahaka/api/MockApiModule.java // @Module // public class MockApiModule { // // @Provides // @Singleton // static PokemonService providePokemonService() { // return Mockito.mock(PokemonService.class); // } // // // }
import android.app.Application; import com.ragdroid.dahaka.DahakaTestApplication; import com.ragdroid.dahaka.activity.AppBindingModule; import com.ragdroid.dahaka.activity.login.LoginActivityTest; import com.ragdroid.dahaka.api.MockApiModule; import javax.inject.Singleton; import dagger.BindsInstance; import dagger.Component; import dagger.android.support.AndroidSupportInjectionModule;
package com.ragdroid.dahaka.app; /** * Created by garimajain on 28/08/17. */ @Singleton @Component(modules = { MockAppModule.class,
// Path: app/src/androidTest/java/com/ragdroid/dahaka/DahakaTestApplication.java // public class DahakaTestApplication extends DahakaApplication { // // public TestComponent getTestComponent() { // return testComponent; // } // // private TestComponent testComponent; // // @Override // protected void createComponent() { // testComponent = DaggerTestComponent.builder().application(this).build(); // testComponent.inject(this); // } // // } // // Path: app/src/main/java/com/ragdroid/dahaka/activity/AppBindingModule.java // @Module(subcomponents = UserComponent.class) // public abstract class AppBindingModule { // // @ContributesAndroidInjector(modules = LoginModule.class) // @ActivityScope // abstract LoginActivity loginActivity(); // } // // Path: app/src/androidTest/java/com/ragdroid/dahaka/activity/login/LoginActivityTest.java // @RunWith(AndroidJUnit4.class) // public class LoginActivityTest { // // @Inject // PokemonService service; // // @Inject // TestScheduler testScheduler; // // @Rule // public ActivityTestRule<LoginActivity> activityRule = new ActivityTestRule<>( // LoginActivity.class, true); // // @Before // public void setUp() throws Exception { // Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); // DahakaTestApplication app // = (DahakaTestApplication) instrumentation.getTargetContext().getApplicationContext(); // TestComponent component = (TestComponent) app.getTestComponent(); // component.inject(this); // } // // @Test // public void testOne() throws InterruptedException { // when(service.getPokemon("pikachu")).thenReturn(Single.just(TestDataFactory.getDummyPokemon())); // LoginActivity loginActivity = activityRule.launchActivity(new Intent()); // onView(withId(R.id.login_input)).perform(typeText("pikachu"), closeSoftKeyboard()); // // onView(withId(R.id.login_submit_button)) // .perform(click()); // testScheduler.triggerActions(); // onView(withText("Login Successful")) // .inRoot(withDecorView(not(is(loginActivity.getWindow().getDecorView())))) // .check(matches(isDisplayed())); // // // } // // } // // Path: app/src/androidTest/java/com/ragdroid/dahaka/api/MockApiModule.java // @Module // public class MockApiModule { // // @Provides // @Singleton // static PokemonService providePokemonService() { // return Mockito.mock(PokemonService.class); // } // // // } // Path: app/src/androidTest/java/com/ragdroid/dahaka/app/TestComponent.java import android.app.Application; import com.ragdroid.dahaka.DahakaTestApplication; import com.ragdroid.dahaka.activity.AppBindingModule; import com.ragdroid.dahaka.activity.login.LoginActivityTest; import com.ragdroid.dahaka.api.MockApiModule; import javax.inject.Singleton; import dagger.BindsInstance; import dagger.Component; import dagger.android.support.AndroidSupportInjectionModule; package com.ragdroid.dahaka.app; /** * Created by garimajain on 28/08/17. */ @Singleton @Component(modules = { MockAppModule.class,
MockApiModule.class,
ragdroid/Dahaka
app/src/androidTest/java/com/ragdroid/dahaka/app/TestComponent.java
// Path: app/src/androidTest/java/com/ragdroid/dahaka/DahakaTestApplication.java // public class DahakaTestApplication extends DahakaApplication { // // public TestComponent getTestComponent() { // return testComponent; // } // // private TestComponent testComponent; // // @Override // protected void createComponent() { // testComponent = DaggerTestComponent.builder().application(this).build(); // testComponent.inject(this); // } // // } // // Path: app/src/main/java/com/ragdroid/dahaka/activity/AppBindingModule.java // @Module(subcomponents = UserComponent.class) // public abstract class AppBindingModule { // // @ContributesAndroidInjector(modules = LoginModule.class) // @ActivityScope // abstract LoginActivity loginActivity(); // } // // Path: app/src/androidTest/java/com/ragdroid/dahaka/activity/login/LoginActivityTest.java // @RunWith(AndroidJUnit4.class) // public class LoginActivityTest { // // @Inject // PokemonService service; // // @Inject // TestScheduler testScheduler; // // @Rule // public ActivityTestRule<LoginActivity> activityRule = new ActivityTestRule<>( // LoginActivity.class, true); // // @Before // public void setUp() throws Exception { // Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); // DahakaTestApplication app // = (DahakaTestApplication) instrumentation.getTargetContext().getApplicationContext(); // TestComponent component = (TestComponent) app.getTestComponent(); // component.inject(this); // } // // @Test // public void testOne() throws InterruptedException { // when(service.getPokemon("pikachu")).thenReturn(Single.just(TestDataFactory.getDummyPokemon())); // LoginActivity loginActivity = activityRule.launchActivity(new Intent()); // onView(withId(R.id.login_input)).perform(typeText("pikachu"), closeSoftKeyboard()); // // onView(withId(R.id.login_submit_button)) // .perform(click()); // testScheduler.triggerActions(); // onView(withText("Login Successful")) // .inRoot(withDecorView(not(is(loginActivity.getWindow().getDecorView())))) // .check(matches(isDisplayed())); // // // } // // } // // Path: app/src/androidTest/java/com/ragdroid/dahaka/api/MockApiModule.java // @Module // public class MockApiModule { // // @Provides // @Singleton // static PokemonService providePokemonService() { // return Mockito.mock(PokemonService.class); // } // // // }
import android.app.Application; import com.ragdroid.dahaka.DahakaTestApplication; import com.ragdroid.dahaka.activity.AppBindingModule; import com.ragdroid.dahaka.activity.login.LoginActivityTest; import com.ragdroid.dahaka.api.MockApiModule; import javax.inject.Singleton; import dagger.BindsInstance; import dagger.Component; import dagger.android.support.AndroidSupportInjectionModule;
package com.ragdroid.dahaka.app; /** * Created by garimajain on 28/08/17. */ @Singleton @Component(modules = { MockAppModule.class, MockApiModule.class, TestAppBindingModule.class, AndroidSupportInjectionModule.class}) public interface TestComponent extends AppComponent {
// Path: app/src/androidTest/java/com/ragdroid/dahaka/DahakaTestApplication.java // public class DahakaTestApplication extends DahakaApplication { // // public TestComponent getTestComponent() { // return testComponent; // } // // private TestComponent testComponent; // // @Override // protected void createComponent() { // testComponent = DaggerTestComponent.builder().application(this).build(); // testComponent.inject(this); // } // // } // // Path: app/src/main/java/com/ragdroid/dahaka/activity/AppBindingModule.java // @Module(subcomponents = UserComponent.class) // public abstract class AppBindingModule { // // @ContributesAndroidInjector(modules = LoginModule.class) // @ActivityScope // abstract LoginActivity loginActivity(); // } // // Path: app/src/androidTest/java/com/ragdroid/dahaka/activity/login/LoginActivityTest.java // @RunWith(AndroidJUnit4.class) // public class LoginActivityTest { // // @Inject // PokemonService service; // // @Inject // TestScheduler testScheduler; // // @Rule // public ActivityTestRule<LoginActivity> activityRule = new ActivityTestRule<>( // LoginActivity.class, true); // // @Before // public void setUp() throws Exception { // Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); // DahakaTestApplication app // = (DahakaTestApplication) instrumentation.getTargetContext().getApplicationContext(); // TestComponent component = (TestComponent) app.getTestComponent(); // component.inject(this); // } // // @Test // public void testOne() throws InterruptedException { // when(service.getPokemon("pikachu")).thenReturn(Single.just(TestDataFactory.getDummyPokemon())); // LoginActivity loginActivity = activityRule.launchActivity(new Intent()); // onView(withId(R.id.login_input)).perform(typeText("pikachu"), closeSoftKeyboard()); // // onView(withId(R.id.login_submit_button)) // .perform(click()); // testScheduler.triggerActions(); // onView(withText("Login Successful")) // .inRoot(withDecorView(not(is(loginActivity.getWindow().getDecorView())))) // .check(matches(isDisplayed())); // // // } // // } // // Path: app/src/androidTest/java/com/ragdroid/dahaka/api/MockApiModule.java // @Module // public class MockApiModule { // // @Provides // @Singleton // static PokemonService providePokemonService() { // return Mockito.mock(PokemonService.class); // } // // // } // Path: app/src/androidTest/java/com/ragdroid/dahaka/app/TestComponent.java import android.app.Application; import com.ragdroid.dahaka.DahakaTestApplication; import com.ragdroid.dahaka.activity.AppBindingModule; import com.ragdroid.dahaka.activity.login.LoginActivityTest; import com.ragdroid.dahaka.api.MockApiModule; import javax.inject.Singleton; import dagger.BindsInstance; import dagger.Component; import dagger.android.support.AndroidSupportInjectionModule; package com.ragdroid.dahaka.app; /** * Created by garimajain on 28/08/17. */ @Singleton @Component(modules = { MockAppModule.class, MockApiModule.class, TestAppBindingModule.class, AndroidSupportInjectionModule.class}) public interface TestComponent extends AppComponent {
void inject(DahakaTestApplication instance);
ragdroid/Dahaka
app/src/androidTest/java/com/ragdroid/dahaka/app/TestComponent.java
// Path: app/src/androidTest/java/com/ragdroid/dahaka/DahakaTestApplication.java // public class DahakaTestApplication extends DahakaApplication { // // public TestComponent getTestComponent() { // return testComponent; // } // // private TestComponent testComponent; // // @Override // protected void createComponent() { // testComponent = DaggerTestComponent.builder().application(this).build(); // testComponent.inject(this); // } // // } // // Path: app/src/main/java/com/ragdroid/dahaka/activity/AppBindingModule.java // @Module(subcomponents = UserComponent.class) // public abstract class AppBindingModule { // // @ContributesAndroidInjector(modules = LoginModule.class) // @ActivityScope // abstract LoginActivity loginActivity(); // } // // Path: app/src/androidTest/java/com/ragdroid/dahaka/activity/login/LoginActivityTest.java // @RunWith(AndroidJUnit4.class) // public class LoginActivityTest { // // @Inject // PokemonService service; // // @Inject // TestScheduler testScheduler; // // @Rule // public ActivityTestRule<LoginActivity> activityRule = new ActivityTestRule<>( // LoginActivity.class, true); // // @Before // public void setUp() throws Exception { // Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); // DahakaTestApplication app // = (DahakaTestApplication) instrumentation.getTargetContext().getApplicationContext(); // TestComponent component = (TestComponent) app.getTestComponent(); // component.inject(this); // } // // @Test // public void testOne() throws InterruptedException { // when(service.getPokemon("pikachu")).thenReturn(Single.just(TestDataFactory.getDummyPokemon())); // LoginActivity loginActivity = activityRule.launchActivity(new Intent()); // onView(withId(R.id.login_input)).perform(typeText("pikachu"), closeSoftKeyboard()); // // onView(withId(R.id.login_submit_button)) // .perform(click()); // testScheduler.triggerActions(); // onView(withText("Login Successful")) // .inRoot(withDecorView(not(is(loginActivity.getWindow().getDecorView())))) // .check(matches(isDisplayed())); // // // } // // } // // Path: app/src/androidTest/java/com/ragdroid/dahaka/api/MockApiModule.java // @Module // public class MockApiModule { // // @Provides // @Singleton // static PokemonService providePokemonService() { // return Mockito.mock(PokemonService.class); // } // // // }
import android.app.Application; import com.ragdroid.dahaka.DahakaTestApplication; import com.ragdroid.dahaka.activity.AppBindingModule; import com.ragdroid.dahaka.activity.login.LoginActivityTest; import com.ragdroid.dahaka.api.MockApiModule; import javax.inject.Singleton; import dagger.BindsInstance; import dagger.Component; import dagger.android.support.AndroidSupportInjectionModule;
package com.ragdroid.dahaka.app; /** * Created by garimajain on 28/08/17. */ @Singleton @Component(modules = { MockAppModule.class, MockApiModule.class, TestAppBindingModule.class, AndroidSupportInjectionModule.class}) public interface TestComponent extends AppComponent { void inject(DahakaTestApplication instance);
// Path: app/src/androidTest/java/com/ragdroid/dahaka/DahakaTestApplication.java // public class DahakaTestApplication extends DahakaApplication { // // public TestComponent getTestComponent() { // return testComponent; // } // // private TestComponent testComponent; // // @Override // protected void createComponent() { // testComponent = DaggerTestComponent.builder().application(this).build(); // testComponent.inject(this); // } // // } // // Path: app/src/main/java/com/ragdroid/dahaka/activity/AppBindingModule.java // @Module(subcomponents = UserComponent.class) // public abstract class AppBindingModule { // // @ContributesAndroidInjector(modules = LoginModule.class) // @ActivityScope // abstract LoginActivity loginActivity(); // } // // Path: app/src/androidTest/java/com/ragdroid/dahaka/activity/login/LoginActivityTest.java // @RunWith(AndroidJUnit4.class) // public class LoginActivityTest { // // @Inject // PokemonService service; // // @Inject // TestScheduler testScheduler; // // @Rule // public ActivityTestRule<LoginActivity> activityRule = new ActivityTestRule<>( // LoginActivity.class, true); // // @Before // public void setUp() throws Exception { // Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); // DahakaTestApplication app // = (DahakaTestApplication) instrumentation.getTargetContext().getApplicationContext(); // TestComponent component = (TestComponent) app.getTestComponent(); // component.inject(this); // } // // @Test // public void testOne() throws InterruptedException { // when(service.getPokemon("pikachu")).thenReturn(Single.just(TestDataFactory.getDummyPokemon())); // LoginActivity loginActivity = activityRule.launchActivity(new Intent()); // onView(withId(R.id.login_input)).perform(typeText("pikachu"), closeSoftKeyboard()); // // onView(withId(R.id.login_submit_button)) // .perform(click()); // testScheduler.triggerActions(); // onView(withText("Login Successful")) // .inRoot(withDecorView(not(is(loginActivity.getWindow().getDecorView())))) // .check(matches(isDisplayed())); // // // } // // } // // Path: app/src/androidTest/java/com/ragdroid/dahaka/api/MockApiModule.java // @Module // public class MockApiModule { // // @Provides // @Singleton // static PokemonService providePokemonService() { // return Mockito.mock(PokemonService.class); // } // // // } // Path: app/src/androidTest/java/com/ragdroid/dahaka/app/TestComponent.java import android.app.Application; import com.ragdroid.dahaka.DahakaTestApplication; import com.ragdroid.dahaka.activity.AppBindingModule; import com.ragdroid.dahaka.activity.login.LoginActivityTest; import com.ragdroid.dahaka.api.MockApiModule; import javax.inject.Singleton; import dagger.BindsInstance; import dagger.Component; import dagger.android.support.AndroidSupportInjectionModule; package com.ragdroid.dahaka.app; /** * Created by garimajain on 28/08/17. */ @Singleton @Component(modules = { MockAppModule.class, MockApiModule.class, TestAppBindingModule.class, AndroidSupportInjectionModule.class}) public interface TestComponent extends AppComponent { void inject(DahakaTestApplication instance);
void inject(LoginActivityTest loginActivityTest);
ragdroid/Dahaka
app/src/main/java/com/ragdroid/dahaka/api/ApiModule.java
// Path: app/src/main/java/com/ragdroid/dahaka/user/PokemonService.java // @UserScope // public interface PokemonService { // // /** // * fetch pokemon user // * @param id // * @return // */ // @Headers("Content-Type: application/json") // @GET("pokemon/{name}") // Single<Pokemon> getPokemon(@Path("name") String id); // // }
import android.app.Application; import com.google.gson.FieldNamingPolicy; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.ragdroid.dahaka.user.PokemonService; import java.util.concurrent.TimeUnit; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import okhttp3.Cache; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor; import retrofit2.Retrofit; import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; import retrofit2.converter.gson.GsonConverterFactory;
OkHttpClient.Builder builder = new OkHttpClient.Builder() .cache(cache) .addInterceptor(loggingInterceptor) .connectTimeout(60, TimeUnit.SECONDS) .readTimeout(60, TimeUnit.SECONDS) .writeTimeout(60, TimeUnit.SECONDS) .addNetworkInterceptor(cacheOverrideInterceptor); return builder .build(); } @Provides @Singleton static Retrofit provideRetrofit(Gson gson, OkHttpClient okHttpClient) { return new Retrofit.Builder() .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .addConverterFactory(GsonConverterFactory.create(gson)) .baseUrl(getBaseUrl()) .client(okHttpClient) .build(); } protected static String getBaseUrl() { return "http://pokeapi.co/api/v2/"; } @Provides @Singleton
// Path: app/src/main/java/com/ragdroid/dahaka/user/PokemonService.java // @UserScope // public interface PokemonService { // // /** // * fetch pokemon user // * @param id // * @return // */ // @Headers("Content-Type: application/json") // @GET("pokemon/{name}") // Single<Pokemon> getPokemon(@Path("name") String id); // // } // Path: app/src/main/java/com/ragdroid/dahaka/api/ApiModule.java import android.app.Application; import com.google.gson.FieldNamingPolicy; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.ragdroid.dahaka.user.PokemonService; import java.util.concurrent.TimeUnit; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import okhttp3.Cache; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor; import retrofit2.Retrofit; import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; import retrofit2.converter.gson.GsonConverterFactory; OkHttpClient.Builder builder = new OkHttpClient.Builder() .cache(cache) .addInterceptor(loggingInterceptor) .connectTimeout(60, TimeUnit.SECONDS) .readTimeout(60, TimeUnit.SECONDS) .writeTimeout(60, TimeUnit.SECONDS) .addNetworkInterceptor(cacheOverrideInterceptor); return builder .build(); } @Provides @Singleton static Retrofit provideRetrofit(Gson gson, OkHttpClient okHttpClient) { return new Retrofit.Builder() .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .addConverterFactory(GsonConverterFactory.create(gson)) .baseUrl(getBaseUrl()) .client(okHttpClient) .build(); } protected static String getBaseUrl() { return "http://pokeapi.co/api/v2/"; } @Provides @Singleton
public static PokemonService providePokemonService(Retrofit retrofit) {
ragdroid/Dahaka
app/src/main/java/com/ragdroid/dahaka/activity/login/LoginContract.java
// Path: app/src/main/java/com/ragdroid/dahaka/mvp/BasePresenter.java // public interface BasePresenter<T extends BaseView> { // // void onViewAdded(T view); // // void onViewRemoved(); // // } // // Path: app/src/main/java/com/ragdroid/dahaka/mvp/BaseView.java // public interface BaseView { // // void showMessage(String message); // // void finishView(); // // }
import com.ragdroid.dahaka.mvp.BasePresenter; import com.ragdroid.dahaka.mvp.BaseView;
package com.ragdroid.dahaka.activity.login; /** * Created by garimajain on 13/08/17. */ public interface LoginContract { interface View extends BaseView { void showHome(); void setModel(LoginModel loginModel); }
// Path: app/src/main/java/com/ragdroid/dahaka/mvp/BasePresenter.java // public interface BasePresenter<T extends BaseView> { // // void onViewAdded(T view); // // void onViewRemoved(); // // } // // Path: app/src/main/java/com/ragdroid/dahaka/mvp/BaseView.java // public interface BaseView { // // void showMessage(String message); // // void finishView(); // // } // Path: app/src/main/java/com/ragdroid/dahaka/activity/login/LoginContract.java import com.ragdroid.dahaka.mvp.BasePresenter; import com.ragdroid.dahaka.mvp.BaseView; package com.ragdroid.dahaka.activity.login; /** * Created by garimajain on 13/08/17. */ public interface LoginContract { interface View extends BaseView { void showHome(); void setModel(LoginModel loginModel); }
interface Presenter extends BasePresenter<View> {
ragdroid/Dahaka
app/src/main/java/com/ragdroid/dahaka/activity/home/HomeContract.java
// Path: app/src/main/java/com/ragdroid/dahaka/mvp/BasePresenter.java // public interface BasePresenter<T extends BaseView> { // // void onViewAdded(T view); // // void onViewRemoved(); // // } // // Path: app/src/main/java/com/ragdroid/dahaka/mvp/BaseView.java // public interface BaseView { // // void showMessage(String message); // // void finishView(); // // }
import com.ragdroid.dahaka.mvp.BasePresenter; import com.ragdroid.dahaka.mvp.BaseView;
package com.ragdroid.dahaka.activity.home; /** * Created by garimajain on 13/08/17. */ public interface HomeContract { interface View extends BaseView { }
// Path: app/src/main/java/com/ragdroid/dahaka/mvp/BasePresenter.java // public interface BasePresenter<T extends BaseView> { // // void onViewAdded(T view); // // void onViewRemoved(); // // } // // Path: app/src/main/java/com/ragdroid/dahaka/mvp/BaseView.java // public interface BaseView { // // void showMessage(String message); // // void finishView(); // // } // Path: app/src/main/java/com/ragdroid/dahaka/activity/home/HomeContract.java import com.ragdroid.dahaka.mvp.BasePresenter; import com.ragdroid.dahaka.mvp.BaseView; package com.ragdroid.dahaka.activity.home; /** * Created by garimajain on 13/08/17. */ public interface HomeContract { interface View extends BaseView { }
interface Presenter extends BasePresenter<View> {
ragdroid/Dahaka
app/src/main/java/com/ragdroid/dahaka/mvp/BaseFragment.java
// Path: app/src/main/java/com/ragdroid/dahaka/activity/login/LoginActivity.java // public class LoginActivity extends BaseActivity<LoginContract.Presenter> implements LoginContract.View { // // private ActivityLoginBinding binding; // // @Override // protected void onCreate(Bundle savedInstanceState) { // binding = DataBindingUtil.setContentView(this, R.layout.activity_login); // super.onCreate(savedInstanceState); // Toolbar toolbar = findViewById(R.id.toolbar); // setSupportActionBar(toolbar); // toolbar.setTitle(R.string.title_activity_login); // binding.setPresenter(getPresenter()); // } // // @Override // public void showHome() { // Intent intent = new Intent(this, HomeActivity.class); // startActivity(intent); // finish(); // } // // @Override // public void setModel(LoginModel loginModel) { // binding.setModel(loginModel); // } // }
import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.widget.Toast; import com.ragdroid.dahaka.R; import com.ragdroid.dahaka.activity.login.LoginActivity; import javax.inject.Inject; import dagger.android.support.DaggerFragment;
package com.ragdroid.dahaka.mvp; /** * Created by garimajain on 13/08/17. */ public abstract class BaseFragment<T extends BasePresenter> extends DaggerFragment implements BaseView { public T getPresenter() { return presenter; } @Inject T presenter; @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); presenter.onViewAdded(this); } @Override public void showMessage(String message) { Toast.makeText(getActivity(), message, Toast.LENGTH_SHORT).show(); } @Override public void onDetach() { presenter.onViewRemoved(); super.onDetach(); } @Override public void finishView() { showMessage(getString(R.string.session_expired));
// Path: app/src/main/java/com/ragdroid/dahaka/activity/login/LoginActivity.java // public class LoginActivity extends BaseActivity<LoginContract.Presenter> implements LoginContract.View { // // private ActivityLoginBinding binding; // // @Override // protected void onCreate(Bundle savedInstanceState) { // binding = DataBindingUtil.setContentView(this, R.layout.activity_login); // super.onCreate(savedInstanceState); // Toolbar toolbar = findViewById(R.id.toolbar); // setSupportActionBar(toolbar); // toolbar.setTitle(R.string.title_activity_login); // binding.setPresenter(getPresenter()); // } // // @Override // public void showHome() { // Intent intent = new Intent(this, HomeActivity.class); // startActivity(intent); // finish(); // } // // @Override // public void setModel(LoginModel loginModel) { // binding.setModel(loginModel); // } // } // Path: app/src/main/java/com/ragdroid/dahaka/mvp/BaseFragment.java import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.widget.Toast; import com.ragdroid.dahaka.R; import com.ragdroid.dahaka.activity.login.LoginActivity; import javax.inject.Inject; import dagger.android.support.DaggerFragment; package com.ragdroid.dahaka.mvp; /** * Created by garimajain on 13/08/17. */ public abstract class BaseFragment<T extends BasePresenter> extends DaggerFragment implements BaseView { public T getPresenter() { return presenter; } @Inject T presenter; @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); presenter.onViewAdded(this); } @Override public void showMessage(String message) { Toast.makeText(getActivity(), message, Toast.LENGTH_SHORT).show(); } @Override public void onDetach() { presenter.onViewRemoved(); super.onDetach(); } @Override public void finishView() { showMessage(getString(R.string.session_expired));
startActivity(new Intent(getActivity(), LoginActivity.class));
ragdroid/Dahaka
app/src/main/java/com/ragdroid/dahaka/DahakaApplication.java
// Path: app/src/main/java/com/ragdroid/dahaka/app/AppComponent.java // @Singleton // @Component(modules = { // AppModule.class, // ApiModule.class, // AppBindingModule.class, // AndroidSupportInjectionModule.class}) // public interface AppComponent extends AndroidInjector<DaggerApplication> { // // // UserComponent.Builder userBuilder(); // // UserManager getUserManager(); // // void inject(DahakaApplication instance); // // @Component.Builder // interface Builder { // // AppComponent build(); // // @BindsInstance // Builder application(Application application); // Builder apiModule(ApiModule apiModule); // } // // } // // Path: app/src/main/java/com/ragdroid/dahaka/app/UserManager.java // @Singleton // public class UserManager implements HasActivityInjector { // // // private final PokemonService service; // private final UserComponent.Builder userComponentBuilder; // @Inject DispatchingAndroidInjector<Activity> activityInjector; // // private Pokemon pokemonCache; // // private UserComponent userComponent; // // @Inject // public UserManager(PokemonService service, UserComponent.Builder builder) { // this.service = service; // this.userComponentBuilder = builder; // } // // public Flowable<Pokemon> loginWithUserName(String userName) { // return getPokemonMaybeFromCache() // .concatWith(service.getPokemon(userName).toMaybe()) // .take(1) // .doOnNext(this::createUserSession); // } // // private void createUserSession(Pokemon pokemon) { // userComponent = userComponentBuilder // .pokeMon(pokemon) // .build(); // userComponent.inject(this); // } // // // private Maybe<Pokemon> getPokemonMaybeFromCache() { // if (pokemonCache != null) { // return Maybe.just(pokemonCache); // } else { // return Maybe.empty(); // } // } // // public boolean isLoggedIn() { // return userComponent != null; // } // // public void logOut() { // pokemonCache = null; // userComponent = null; // } // // @Override // public AndroidInjector<Activity> activityInjector() { // return activityInjector; // } // }
import android.app.Activity; import android.app.Application; import android.databinding.DataBindingComponent; import android.databinding.DataBindingUtil; import com.ragdroid.dahaka.app.AppComponent; import com.ragdroid.dahaka.app.DaggerAppComponent; import com.ragdroid.dahaka.app.DaggerAppDataBindingComponent; import com.ragdroid.dahaka.app.UserManager; import javax.inject.Inject; import dagger.android.AndroidInjector; import dagger.android.DispatchingAndroidInjector; import dagger.android.HasActivityInjector;
package com.ragdroid.dahaka; /** * Created by garimajain on 13/08/17. */ public class DahakaApplication extends Application implements HasActivityInjector { @Inject DispatchingAndroidInjector<Activity> activityInjector;
// Path: app/src/main/java/com/ragdroid/dahaka/app/AppComponent.java // @Singleton // @Component(modules = { // AppModule.class, // ApiModule.class, // AppBindingModule.class, // AndroidSupportInjectionModule.class}) // public interface AppComponent extends AndroidInjector<DaggerApplication> { // // // UserComponent.Builder userBuilder(); // // UserManager getUserManager(); // // void inject(DahakaApplication instance); // // @Component.Builder // interface Builder { // // AppComponent build(); // // @BindsInstance // Builder application(Application application); // Builder apiModule(ApiModule apiModule); // } // // } // // Path: app/src/main/java/com/ragdroid/dahaka/app/UserManager.java // @Singleton // public class UserManager implements HasActivityInjector { // // // private final PokemonService service; // private final UserComponent.Builder userComponentBuilder; // @Inject DispatchingAndroidInjector<Activity> activityInjector; // // private Pokemon pokemonCache; // // private UserComponent userComponent; // // @Inject // public UserManager(PokemonService service, UserComponent.Builder builder) { // this.service = service; // this.userComponentBuilder = builder; // } // // public Flowable<Pokemon> loginWithUserName(String userName) { // return getPokemonMaybeFromCache() // .concatWith(service.getPokemon(userName).toMaybe()) // .take(1) // .doOnNext(this::createUserSession); // } // // private void createUserSession(Pokemon pokemon) { // userComponent = userComponentBuilder // .pokeMon(pokemon) // .build(); // userComponent.inject(this); // } // // // private Maybe<Pokemon> getPokemonMaybeFromCache() { // if (pokemonCache != null) { // return Maybe.just(pokemonCache); // } else { // return Maybe.empty(); // } // } // // public boolean isLoggedIn() { // return userComponent != null; // } // // public void logOut() { // pokemonCache = null; // userComponent = null; // } // // @Override // public AndroidInjector<Activity> activityInjector() { // return activityInjector; // } // } // Path: app/src/main/java/com/ragdroid/dahaka/DahakaApplication.java import android.app.Activity; import android.app.Application; import android.databinding.DataBindingComponent; import android.databinding.DataBindingUtil; import com.ragdroid.dahaka.app.AppComponent; import com.ragdroid.dahaka.app.DaggerAppComponent; import com.ragdroid.dahaka.app.DaggerAppDataBindingComponent; import com.ragdroid.dahaka.app.UserManager; import javax.inject.Inject; import dagger.android.AndroidInjector; import dagger.android.DispatchingAndroidInjector; import dagger.android.HasActivityInjector; package com.ragdroid.dahaka; /** * Created by garimajain on 13/08/17. */ public class DahakaApplication extends Application implements HasActivityInjector { @Inject DispatchingAndroidInjector<Activity> activityInjector;
@Inject UserManager userManager;
ragdroid/Dahaka
app/src/main/java/com/ragdroid/dahaka/DahakaApplication.java
// Path: app/src/main/java/com/ragdroid/dahaka/app/AppComponent.java // @Singleton // @Component(modules = { // AppModule.class, // ApiModule.class, // AppBindingModule.class, // AndroidSupportInjectionModule.class}) // public interface AppComponent extends AndroidInjector<DaggerApplication> { // // // UserComponent.Builder userBuilder(); // // UserManager getUserManager(); // // void inject(DahakaApplication instance); // // @Component.Builder // interface Builder { // // AppComponent build(); // // @BindsInstance // Builder application(Application application); // Builder apiModule(ApiModule apiModule); // } // // } // // Path: app/src/main/java/com/ragdroid/dahaka/app/UserManager.java // @Singleton // public class UserManager implements HasActivityInjector { // // // private final PokemonService service; // private final UserComponent.Builder userComponentBuilder; // @Inject DispatchingAndroidInjector<Activity> activityInjector; // // private Pokemon pokemonCache; // // private UserComponent userComponent; // // @Inject // public UserManager(PokemonService service, UserComponent.Builder builder) { // this.service = service; // this.userComponentBuilder = builder; // } // // public Flowable<Pokemon> loginWithUserName(String userName) { // return getPokemonMaybeFromCache() // .concatWith(service.getPokemon(userName).toMaybe()) // .take(1) // .doOnNext(this::createUserSession); // } // // private void createUserSession(Pokemon pokemon) { // userComponent = userComponentBuilder // .pokeMon(pokemon) // .build(); // userComponent.inject(this); // } // // // private Maybe<Pokemon> getPokemonMaybeFromCache() { // if (pokemonCache != null) { // return Maybe.just(pokemonCache); // } else { // return Maybe.empty(); // } // } // // public boolean isLoggedIn() { // return userComponent != null; // } // // public void logOut() { // pokemonCache = null; // userComponent = null; // } // // @Override // public AndroidInjector<Activity> activityInjector() { // return activityInjector; // } // }
import android.app.Activity; import android.app.Application; import android.databinding.DataBindingComponent; import android.databinding.DataBindingUtil; import com.ragdroid.dahaka.app.AppComponent; import com.ragdroid.dahaka.app.DaggerAppComponent; import com.ragdroid.dahaka.app.DaggerAppDataBindingComponent; import com.ragdroid.dahaka.app.UserManager; import javax.inject.Inject; import dagger.android.AndroidInjector; import dagger.android.DispatchingAndroidInjector; import dagger.android.HasActivityInjector;
package com.ragdroid.dahaka; /** * Created by garimajain on 13/08/17. */ public class DahakaApplication extends Application implements HasActivityInjector { @Inject DispatchingAndroidInjector<Activity> activityInjector; @Inject UserManager userManager;
// Path: app/src/main/java/com/ragdroid/dahaka/app/AppComponent.java // @Singleton // @Component(modules = { // AppModule.class, // ApiModule.class, // AppBindingModule.class, // AndroidSupportInjectionModule.class}) // public interface AppComponent extends AndroidInjector<DaggerApplication> { // // // UserComponent.Builder userBuilder(); // // UserManager getUserManager(); // // void inject(DahakaApplication instance); // // @Component.Builder // interface Builder { // // AppComponent build(); // // @BindsInstance // Builder application(Application application); // Builder apiModule(ApiModule apiModule); // } // // } // // Path: app/src/main/java/com/ragdroid/dahaka/app/UserManager.java // @Singleton // public class UserManager implements HasActivityInjector { // // // private final PokemonService service; // private final UserComponent.Builder userComponentBuilder; // @Inject DispatchingAndroidInjector<Activity> activityInjector; // // private Pokemon pokemonCache; // // private UserComponent userComponent; // // @Inject // public UserManager(PokemonService service, UserComponent.Builder builder) { // this.service = service; // this.userComponentBuilder = builder; // } // // public Flowable<Pokemon> loginWithUserName(String userName) { // return getPokemonMaybeFromCache() // .concatWith(service.getPokemon(userName).toMaybe()) // .take(1) // .doOnNext(this::createUserSession); // } // // private void createUserSession(Pokemon pokemon) { // userComponent = userComponentBuilder // .pokeMon(pokemon) // .build(); // userComponent.inject(this); // } // // // private Maybe<Pokemon> getPokemonMaybeFromCache() { // if (pokemonCache != null) { // return Maybe.just(pokemonCache); // } else { // return Maybe.empty(); // } // } // // public boolean isLoggedIn() { // return userComponent != null; // } // // public void logOut() { // pokemonCache = null; // userComponent = null; // } // // @Override // public AndroidInjector<Activity> activityInjector() { // return activityInjector; // } // } // Path: app/src/main/java/com/ragdroid/dahaka/DahakaApplication.java import android.app.Activity; import android.app.Application; import android.databinding.DataBindingComponent; import android.databinding.DataBindingUtil; import com.ragdroid.dahaka.app.AppComponent; import com.ragdroid.dahaka.app.DaggerAppComponent; import com.ragdroid.dahaka.app.DaggerAppDataBindingComponent; import com.ragdroid.dahaka.app.UserManager; import javax.inject.Inject; import dagger.android.AndroidInjector; import dagger.android.DispatchingAndroidInjector; import dagger.android.HasActivityInjector; package com.ragdroid.dahaka; /** * Created by garimajain on 13/08/17. */ public class DahakaApplication extends Application implements HasActivityInjector { @Inject DispatchingAndroidInjector<Activity> activityInjector; @Inject UserManager userManager;
public AppComponent getAppComponent() {
saveendhiman/SampleApp
app/src/main/java/com/sampleapp/base/SampleApplication.java
// Path: app/src/main/java/com/sampleapp/utils/UtilsModule.java // @Module // public class UtilsModule { // // private Context mContext; // // public UtilsModule(Context context) { // this.mContext = context; // } // // // get AppUtils instance // @Provides // @Singleton // public AppUtils getAppUtils() { // return new AppUtils(mContext); // } // // // get DateTimeUtils instance // @Provides // @Singleton // public DateTimeUtils getDateTimeUtils() { // return new DateTimeUtils(); // } // // // get ProgressBarHandler instance // @Provides // @Singleton // public ProgressBarHandler getProgressBar() { // return new ProgressBarHandler(mContext); // } // // //get dialog utils // @Provides // @Singleton // public DialogsUtil getDialogUtils() { // return new DialogsUtil(mContext); // } // // //get new thread // @Provides // @Singleton // @Named(ValueConstants.NEW_THREAD) // public Scheduler getNewThread() { // return Schedulers.io(); // } // // //get main thread // @Provides // @Singleton // @Named(ValueConstants.MAIN_THREAD) // public Scheduler getMainThread() { // return AndroidSchedulers.mainThread(); // } // // //get Preference Manager // @Provides // @Singleton // public PreferenceManager getPreferences() { // return new PreferenceManager(mContext); // } // // //get Fragment utils // @Provides // @Singleton // public FragmentUtils getFragUtils() { // return new FragmentUtils(); // } // // //get location helper methods // @Provides // @Singleton // public LocationHelper getLocationUtils() { // return new LocationHelper(mContext); // } // // //get location tracker // @Provides // @Singleton // public LocationTracker getLocationTrackerOF() { // return new LocationTracker(mContext); // } // // //get image utils // @Provides // @Singleton // public ImageUtility getImageUtils() { // return new ImageUtility(mContext); // } // // }
import android.app.Application; import com.crashlytics.android.Crashlytics; import com.sampleapp.BuildConfig; import com.sampleapp.utils.UtilsModule; import io.fabric.sdk.android.Fabric; import timber.log.Timber;
package com.sampleapp.base; /** * Created by saveen_dhiman on 05-November-16. * Initialization of required libraries */ public class SampleApplication extends Application { private AppComponent mAppComponent; @Override public void onCreate() { super.onCreate(); Fabric.with(this, new Crashlytics()); //create component mAppComponent = DaggerAppComponent.builder()
// Path: app/src/main/java/com/sampleapp/utils/UtilsModule.java // @Module // public class UtilsModule { // // private Context mContext; // // public UtilsModule(Context context) { // this.mContext = context; // } // // // get AppUtils instance // @Provides // @Singleton // public AppUtils getAppUtils() { // return new AppUtils(mContext); // } // // // get DateTimeUtils instance // @Provides // @Singleton // public DateTimeUtils getDateTimeUtils() { // return new DateTimeUtils(); // } // // // get ProgressBarHandler instance // @Provides // @Singleton // public ProgressBarHandler getProgressBar() { // return new ProgressBarHandler(mContext); // } // // //get dialog utils // @Provides // @Singleton // public DialogsUtil getDialogUtils() { // return new DialogsUtil(mContext); // } // // //get new thread // @Provides // @Singleton // @Named(ValueConstants.NEW_THREAD) // public Scheduler getNewThread() { // return Schedulers.io(); // } // // //get main thread // @Provides // @Singleton // @Named(ValueConstants.MAIN_THREAD) // public Scheduler getMainThread() { // return AndroidSchedulers.mainThread(); // } // // //get Preference Manager // @Provides // @Singleton // public PreferenceManager getPreferences() { // return new PreferenceManager(mContext); // } // // //get Fragment utils // @Provides // @Singleton // public FragmentUtils getFragUtils() { // return new FragmentUtils(); // } // // //get location helper methods // @Provides // @Singleton // public LocationHelper getLocationUtils() { // return new LocationHelper(mContext); // } // // //get location tracker // @Provides // @Singleton // public LocationTracker getLocationTrackerOF() { // return new LocationTracker(mContext); // } // // //get image utils // @Provides // @Singleton // public ImageUtility getImageUtils() { // return new ImageUtility(mContext); // } // // } // Path: app/src/main/java/com/sampleapp/base/SampleApplication.java import android.app.Application; import com.crashlytics.android.Crashlytics; import com.sampleapp.BuildConfig; import com.sampleapp.utils.UtilsModule; import io.fabric.sdk.android.Fabric; import timber.log.Timber; package com.sampleapp.base; /** * Created by saveen_dhiman on 05-November-16. * Initialization of required libraries */ public class SampleApplication extends Application { private AppComponent mAppComponent; @Override public void onCreate() { super.onCreate(); Fabric.with(this, new Crashlytics()); //create component mAppComponent = DaggerAppComponent.builder()
.utilsModule(new UtilsModule(this)).build();
saveendhiman/SampleApp
app/src/main/java/com/sampleapp/utils/PreferenceManager.java
// Path: app/src/main/java/com/sampleapp/constants/PrefernceConstants.java // public interface PrefernceConstants { // String PREFERENCE_NAME = "SAMPLE_APP_PREFERENCES"; // String USER_DATA = "user_data"; // String IS_LOGIN = "isLogin"; // } // // Path: app/src/main/java/com/sampleapp/model/UserData.java // public class UserData { // // /** // * code : 200 // * message : Success // */ // // private StatusBean status; // /** // * auth : {"id":"2746","handle":"saveendhiman","email":"[email protected]","firstname":"saveen","middlename":"0","lastname":"dhiman"} // */ // // private ResponseBean response; // // public StatusBean getStatus() { // return status; // } // // public void setStatus(StatusBean status) { // this.status = status; // } // // public ResponseBean getResponse() { // return response; // } // // public void setResponse(ResponseBean response) { // this.response = response; // } // // public static class StatusBean { // private String code; // private String message; // // public String getCode() { // return code; // } // // public void setCode(String code) { // this.code = code; // } // // public String getMessage() { // return message; // } // // public void setMessage(String message) { // this.message = message; // } // } // // public static class ResponseBean { // /** // * id : 2746 // * handle : saveendhiman // * email : [email protected] // * firstname : saveen // * middlename : 0 // * lastname : dhiman // */ // // private AuthBean auth; // // public AuthBean getAuth() { // return auth; // } // // public void setAuth(AuthBean auth) { // this.auth = auth; // } // // public static class AuthBean { // private String id; // private String handle; // private String email; // private String firstname; // private String middlename; // private String lastname; // private String session_id; // // public String getSession_id() { // return session_id; // } // // public void setSession_id(String session_id) { // this.session_id = session_id; // } // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getHandle() { // return handle; // } // // public void setHandle(String handle) { // this.handle = handle; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // public String getFirstname() { // return firstname; // } // // public void setFirstname(String firstname) { // this.firstname = firstname; // } // // public String getMiddlename() { // return middlename; // } // // public void setMiddlename(String middlename) { // this.middlename = middlename; // } // // public String getLastname() { // return lastname; // } // // public void setLastname(String lastname) { // this.lastname = lastname; // } // } // } // }
import android.content.Context; import android.content.SharedPreferences; import com.google.gson.Gson; import com.sampleapp.constants.PrefernceConstants; import com.sampleapp.model.UserData;
package com.sampleapp.utils; /** * Created by saveen_dhiman on 05-November-16. * Contains method to store and retrieve SharedPreferences data */ public class PreferenceManager { private static Context context1; public PreferenceManager(Context context) { PreferenceManager.context1 = context; } //get shared pref private SharedPreferences getPreferences() {
// Path: app/src/main/java/com/sampleapp/constants/PrefernceConstants.java // public interface PrefernceConstants { // String PREFERENCE_NAME = "SAMPLE_APP_PREFERENCES"; // String USER_DATA = "user_data"; // String IS_LOGIN = "isLogin"; // } // // Path: app/src/main/java/com/sampleapp/model/UserData.java // public class UserData { // // /** // * code : 200 // * message : Success // */ // // private StatusBean status; // /** // * auth : {"id":"2746","handle":"saveendhiman","email":"[email protected]","firstname":"saveen","middlename":"0","lastname":"dhiman"} // */ // // private ResponseBean response; // // public StatusBean getStatus() { // return status; // } // // public void setStatus(StatusBean status) { // this.status = status; // } // // public ResponseBean getResponse() { // return response; // } // // public void setResponse(ResponseBean response) { // this.response = response; // } // // public static class StatusBean { // private String code; // private String message; // // public String getCode() { // return code; // } // // public void setCode(String code) { // this.code = code; // } // // public String getMessage() { // return message; // } // // public void setMessage(String message) { // this.message = message; // } // } // // public static class ResponseBean { // /** // * id : 2746 // * handle : saveendhiman // * email : [email protected] // * firstname : saveen // * middlename : 0 // * lastname : dhiman // */ // // private AuthBean auth; // // public AuthBean getAuth() { // return auth; // } // // public void setAuth(AuthBean auth) { // this.auth = auth; // } // // public static class AuthBean { // private String id; // private String handle; // private String email; // private String firstname; // private String middlename; // private String lastname; // private String session_id; // // public String getSession_id() { // return session_id; // } // // public void setSession_id(String session_id) { // this.session_id = session_id; // } // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getHandle() { // return handle; // } // // public void setHandle(String handle) { // this.handle = handle; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // public String getFirstname() { // return firstname; // } // // public void setFirstname(String firstname) { // this.firstname = firstname; // } // // public String getMiddlename() { // return middlename; // } // // public void setMiddlename(String middlename) { // this.middlename = middlename; // } // // public String getLastname() { // return lastname; // } // // public void setLastname(String lastname) { // this.lastname = lastname; // } // } // } // } // Path: app/src/main/java/com/sampleapp/utils/PreferenceManager.java import android.content.Context; import android.content.SharedPreferences; import com.google.gson.Gson; import com.sampleapp.constants.PrefernceConstants; import com.sampleapp.model.UserData; package com.sampleapp.utils; /** * Created by saveen_dhiman on 05-November-16. * Contains method to store and retrieve SharedPreferences data */ public class PreferenceManager { private static Context context1; public PreferenceManager(Context context) { PreferenceManager.context1 = context; } //get shared pref private SharedPreferences getPreferences() {
return context1.getSharedPreferences(PrefernceConstants.PREFERENCE_NAME, Context.MODE_PRIVATE);
saveendhiman/SampleApp
app/src/main/java/com/sampleapp/utils/PreferenceManager.java
// Path: app/src/main/java/com/sampleapp/constants/PrefernceConstants.java // public interface PrefernceConstants { // String PREFERENCE_NAME = "SAMPLE_APP_PREFERENCES"; // String USER_DATA = "user_data"; // String IS_LOGIN = "isLogin"; // } // // Path: app/src/main/java/com/sampleapp/model/UserData.java // public class UserData { // // /** // * code : 200 // * message : Success // */ // // private StatusBean status; // /** // * auth : {"id":"2746","handle":"saveendhiman","email":"[email protected]","firstname":"saveen","middlename":"0","lastname":"dhiman"} // */ // // private ResponseBean response; // // public StatusBean getStatus() { // return status; // } // // public void setStatus(StatusBean status) { // this.status = status; // } // // public ResponseBean getResponse() { // return response; // } // // public void setResponse(ResponseBean response) { // this.response = response; // } // // public static class StatusBean { // private String code; // private String message; // // public String getCode() { // return code; // } // // public void setCode(String code) { // this.code = code; // } // // public String getMessage() { // return message; // } // // public void setMessage(String message) { // this.message = message; // } // } // // public static class ResponseBean { // /** // * id : 2746 // * handle : saveendhiman // * email : [email protected] // * firstname : saveen // * middlename : 0 // * lastname : dhiman // */ // // private AuthBean auth; // // public AuthBean getAuth() { // return auth; // } // // public void setAuth(AuthBean auth) { // this.auth = auth; // } // // public static class AuthBean { // private String id; // private String handle; // private String email; // private String firstname; // private String middlename; // private String lastname; // private String session_id; // // public String getSession_id() { // return session_id; // } // // public void setSession_id(String session_id) { // this.session_id = session_id; // } // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getHandle() { // return handle; // } // // public void setHandle(String handle) { // this.handle = handle; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // public String getFirstname() { // return firstname; // } // // public void setFirstname(String firstname) { // this.firstname = firstname; // } // // public String getMiddlename() { // return middlename; // } // // public void setMiddlename(String middlename) { // this.middlename = middlename; // } // // public String getLastname() { // return lastname; // } // // public void setLastname(String lastname) { // this.lastname = lastname; // } // } // } // }
import android.content.Context; import android.content.SharedPreferences; import com.google.gson.Gson; import com.sampleapp.constants.PrefernceConstants; import com.sampleapp.model.UserData;
package com.sampleapp.utils; /** * Created by saveen_dhiman on 05-November-16. * Contains method to store and retrieve SharedPreferences data */ public class PreferenceManager { private static Context context1; public PreferenceManager(Context context) { PreferenceManager.context1 = context; } //get shared pref private SharedPreferences getPreferences() { return context1.getSharedPreferences(PrefernceConstants.PREFERENCE_NAME, Context.MODE_PRIVATE); } //save data of current logged in user public void setUserData(String userData) { getPreferences().edit().putString(PrefernceConstants.USER_DATA, userData).commit(); } //get user data as string private String getUserDataFromPref() { return getPreferences().getString(PrefernceConstants.USER_DATA, null); } //get saved data of current user as an object
// Path: app/src/main/java/com/sampleapp/constants/PrefernceConstants.java // public interface PrefernceConstants { // String PREFERENCE_NAME = "SAMPLE_APP_PREFERENCES"; // String USER_DATA = "user_data"; // String IS_LOGIN = "isLogin"; // } // // Path: app/src/main/java/com/sampleapp/model/UserData.java // public class UserData { // // /** // * code : 200 // * message : Success // */ // // private StatusBean status; // /** // * auth : {"id":"2746","handle":"saveendhiman","email":"[email protected]","firstname":"saveen","middlename":"0","lastname":"dhiman"} // */ // // private ResponseBean response; // // public StatusBean getStatus() { // return status; // } // // public void setStatus(StatusBean status) { // this.status = status; // } // // public ResponseBean getResponse() { // return response; // } // // public void setResponse(ResponseBean response) { // this.response = response; // } // // public static class StatusBean { // private String code; // private String message; // // public String getCode() { // return code; // } // // public void setCode(String code) { // this.code = code; // } // // public String getMessage() { // return message; // } // // public void setMessage(String message) { // this.message = message; // } // } // // public static class ResponseBean { // /** // * id : 2746 // * handle : saveendhiman // * email : [email protected] // * firstname : saveen // * middlename : 0 // * lastname : dhiman // */ // // private AuthBean auth; // // public AuthBean getAuth() { // return auth; // } // // public void setAuth(AuthBean auth) { // this.auth = auth; // } // // public static class AuthBean { // private String id; // private String handle; // private String email; // private String firstname; // private String middlename; // private String lastname; // private String session_id; // // public String getSession_id() { // return session_id; // } // // public void setSession_id(String session_id) { // this.session_id = session_id; // } // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getHandle() { // return handle; // } // // public void setHandle(String handle) { // this.handle = handle; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // public String getFirstname() { // return firstname; // } // // public void setFirstname(String firstname) { // this.firstname = firstname; // } // // public String getMiddlename() { // return middlename; // } // // public void setMiddlename(String middlename) { // this.middlename = middlename; // } // // public String getLastname() { // return lastname; // } // // public void setLastname(String lastname) { // this.lastname = lastname; // } // } // } // } // Path: app/src/main/java/com/sampleapp/utils/PreferenceManager.java import android.content.Context; import android.content.SharedPreferences; import com.google.gson.Gson; import com.sampleapp.constants.PrefernceConstants; import com.sampleapp.model.UserData; package com.sampleapp.utils; /** * Created by saveen_dhiman on 05-November-16. * Contains method to store and retrieve SharedPreferences data */ public class PreferenceManager { private static Context context1; public PreferenceManager(Context context) { PreferenceManager.context1 = context; } //get shared pref private SharedPreferences getPreferences() { return context1.getSharedPreferences(PrefernceConstants.PREFERENCE_NAME, Context.MODE_PRIVATE); } //save data of current logged in user public void setUserData(String userData) { getPreferences().edit().putString(PrefernceConstants.USER_DATA, userData).commit(); } //get user data as string private String getUserDataFromPref() { return getPreferences().getString(PrefernceConstants.USER_DATA, null); } //get saved data of current user as an object
public UserData.ResponseBean.AuthBean getUserData() {
saveendhiman/SampleApp
app/src/main/java/com/sampleapp/utils/UtilsModule.java
// Path: app/src/main/java/com/sampleapp/constants/ValueConstants.java // public interface ValueConstants { // // String LOCATION_PERMISSION = android.Manifest.permission.ACCESS_FINE_LOCATION; // int REQUEST_CAMERA = 1001; // int REQUEST_Gallery = 1002; // int REQUEST_LOCATION = 1003; // String DEVICE_TYPE = "android"; // String NEW_THREAD = "newThread"; // String MAIN_THREAD = "mainThread"; // String DATE_INPUT_FORMAT = "yyyy-MM-dd HH:mm:ss"; // String DATE_OUTPUT_FORMAT = "EEEE, h:mm a"; // // // type check for error during login // @IntDef({ValidationType.VALID, ValidationType.USER_NAME_INVALID, ValidationType.PASSWORD_INVALID}) // @Retention(RetentionPolicy.SOURCE) // @interface ValidationType { // int VALID = 0, USER_NAME_INVALID = 1, PASSWORD_INVALID = 2; // } // // // type of dialog opened in MainActivity // @IntDef({DialogType.DIALOG_DENY, DialogType.DIALOG_NEVER_ASK}) // @Retention(RetentionPolicy.SOURCE) // @interface DialogType { // int DIALOG_DENY = 0, DIALOG_NEVER_ASK = 1; // } // }
import android.content.Context; import com.sampleapp.constants.ValueConstants; import javax.inject.Named; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import rx.Scheduler; import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers;
package com.sampleapp.utils; /** * Created by saveen_dhiman on 05-November-16. * Provide injects for utility objects */ @Module public class UtilsModule { private Context mContext; public UtilsModule(Context context) { this.mContext = context; } // get AppUtils instance @Provides @Singleton public AppUtils getAppUtils() { return new AppUtils(mContext); } // get DateTimeUtils instance @Provides @Singleton public DateTimeUtils getDateTimeUtils() { return new DateTimeUtils(); } // get ProgressBarHandler instance @Provides @Singleton public ProgressBarHandler getProgressBar() { return new ProgressBarHandler(mContext); } //get dialog utils @Provides @Singleton public DialogsUtil getDialogUtils() { return new DialogsUtil(mContext); } //get new thread @Provides @Singleton
// Path: app/src/main/java/com/sampleapp/constants/ValueConstants.java // public interface ValueConstants { // // String LOCATION_PERMISSION = android.Manifest.permission.ACCESS_FINE_LOCATION; // int REQUEST_CAMERA = 1001; // int REQUEST_Gallery = 1002; // int REQUEST_LOCATION = 1003; // String DEVICE_TYPE = "android"; // String NEW_THREAD = "newThread"; // String MAIN_THREAD = "mainThread"; // String DATE_INPUT_FORMAT = "yyyy-MM-dd HH:mm:ss"; // String DATE_OUTPUT_FORMAT = "EEEE, h:mm a"; // // // type check for error during login // @IntDef({ValidationType.VALID, ValidationType.USER_NAME_INVALID, ValidationType.PASSWORD_INVALID}) // @Retention(RetentionPolicy.SOURCE) // @interface ValidationType { // int VALID = 0, USER_NAME_INVALID = 1, PASSWORD_INVALID = 2; // } // // // type of dialog opened in MainActivity // @IntDef({DialogType.DIALOG_DENY, DialogType.DIALOG_NEVER_ASK}) // @Retention(RetentionPolicy.SOURCE) // @interface DialogType { // int DIALOG_DENY = 0, DIALOG_NEVER_ASK = 1; // } // } // Path: app/src/main/java/com/sampleapp/utils/UtilsModule.java import android.content.Context; import com.sampleapp.constants.ValueConstants; import javax.inject.Named; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import rx.Scheduler; import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers; package com.sampleapp.utils; /** * Created by saveen_dhiman on 05-November-16. * Provide injects for utility objects */ @Module public class UtilsModule { private Context mContext; public UtilsModule(Context context) { this.mContext = context; } // get AppUtils instance @Provides @Singleton public AppUtils getAppUtils() { return new AppUtils(mContext); } // get DateTimeUtils instance @Provides @Singleton public DateTimeUtils getDateTimeUtils() { return new DateTimeUtils(); } // get ProgressBarHandler instance @Provides @Singleton public ProgressBarHandler getProgressBar() { return new ProgressBarHandler(mContext); } //get dialog utils @Provides @Singleton public DialogsUtil getDialogUtils() { return new DialogsUtil(mContext); } //get new thread @Provides @Singleton
@Named(ValueConstants.NEW_THREAD)
saveendhiman/SampleApp
app/src/main/java/com/sampleapp/api/NetModule.java
// Path: app/src/main/java/com/sampleapp/constants/ApiConstants.java // public interface ApiConstants { // int STATUS_SUCCESS = 200; // String STATUS_SESSION_EXPIRE = "203"; // String BASE_URL = "http://abc.com/"; // String CONTROLLER = "/index.php/webController"; // String LOGIN = CONTROLLER + "/apilogin"; // // }
import com.sampleapp.constants.ApiConstants; import java.util.concurrent.TimeUnit; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import okhttp3.OkHttpClient; import okhttp3.logging.HttpLoggingInterceptor; import retrofit2.Retrofit; import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; import retrofit2.converter.gson.GsonConverterFactory;
package com.sampleapp.api; /** * Created by saveen_dhiman on 05-November-16. * contains object related to network communication and API consumption */ @Module public class NetModule { //get retrofit instance @Singleton @Provides public RestService getRestService() { Retrofit retrofit = new Retrofit.Builder()
// Path: app/src/main/java/com/sampleapp/constants/ApiConstants.java // public interface ApiConstants { // int STATUS_SUCCESS = 200; // String STATUS_SESSION_EXPIRE = "203"; // String BASE_URL = "http://abc.com/"; // String CONTROLLER = "/index.php/webController"; // String LOGIN = CONTROLLER + "/apilogin"; // // } // Path: app/src/main/java/com/sampleapp/api/NetModule.java import com.sampleapp.constants.ApiConstants; import java.util.concurrent.TimeUnit; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import okhttp3.OkHttpClient; import okhttp3.logging.HttpLoggingInterceptor; import retrofit2.Retrofit; import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; import retrofit2.converter.gson.GsonConverterFactory; package com.sampleapp.api; /** * Created by saveen_dhiman on 05-November-16. * contains object related to network communication and API consumption */ @Module public class NetModule { //get retrofit instance @Singleton @Provides public RestService getRestService() { Retrofit retrofit = new Retrofit.Builder()
.baseUrl(ApiConstants.BASE_URL)
saveendhiman/SampleApp
app/src/main/java/com/sampleapp/utils/DialogsUtil.java
// Path: app/src/main/java/com/sampleapp/interfaces/OnDialogButtonClickListener.java // public interface OnDialogButtonClickListener { // // void onPositiveButtonClicked(); // // void onNegativeButtonClicked(); // }
import android.app.AlertDialog; import android.content.Context; import com.sampleapp.R; import com.sampleapp.interfaces.OnDialogButtonClickListener;
package com.sampleapp.utils; /** * Created by saveen_dhiman on 05-November-16. * contains Dialogs to be used in the application */ public class DialogsUtil { private Context mContext; public DialogsUtil(Context context) { this.mContext = context; } /** * Return an alert dialog * * @param message message for the alert dialog * @param listener listener to trigger selection methods */ public void openAlertDialog(Context context, String message, String positiveBtnText, String negativeBtnText,
// Path: app/src/main/java/com/sampleapp/interfaces/OnDialogButtonClickListener.java // public interface OnDialogButtonClickListener { // // void onPositiveButtonClicked(); // // void onNegativeButtonClicked(); // } // Path: app/src/main/java/com/sampleapp/utils/DialogsUtil.java import android.app.AlertDialog; import android.content.Context; import com.sampleapp.R; import com.sampleapp.interfaces.OnDialogButtonClickListener; package com.sampleapp.utils; /** * Created by saveen_dhiman on 05-November-16. * contains Dialogs to be used in the application */ public class DialogsUtil { private Context mContext; public DialogsUtil(Context context) { this.mContext = context; } /** * Return an alert dialog * * @param message message for the alert dialog * @param listener listener to trigger selection methods */ public void openAlertDialog(Context context, String message, String positiveBtnText, String negativeBtnText,
final OnDialogButtonClickListener listener) {
saveendhiman/SampleApp
app/src/main/java/com/sampleapp/module/SplashActivity.java
// Path: app/src/main/java/com/sampleapp/module/login/LoginActivity.java // public class LoginActivity extends BaseActivity implements LoginView { // // @Inject // ProgressBarHandler mProgressHandler; // @Inject // LoginPresenter mLoginPresenter; // @Inject // AppUtils mAppUtils; // // @NotEmpty(messageId = R.string.warning_field_empty, order = 1) // @BindView(R.id.edtUserName) // RemoveErrorEditText mEdtUserName; // // @MinLength(value = 6, messageId = R.string.warning_password_length, order = 2) // @BindView(R.id.edtPassword) // RemoveErrorEditText mEdtPassword; // // @Override // protected void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // // //create component // DaggerLoginComponent.builder() // .utilsModule(new UtilsModule(this)) // .loginModule(new LoginModule(this)) // .build().inject(this); // // mLoginPresenter.attachView(this); // } // // //set layout for this activity // @Override // public int getLayout() { // return R.layout.activity_login; // } // // //return intent for this activity // public static Intent createIntent(Context context) { // return new Intent(context, LoginActivity.class); // } // // @Override // public void onLoginSuccess() { // // } // // @Override // public void closeApplication() { // // } // // @Override // public void showProgress() { // mProgressHandler.showProgress(); // } // // @Override // public void hideProgress() { // mProgressHandler.hideProgress(); // } // // @Override // public void onError(Throwable t) { // t.printStackTrace(); // mAppUtils.showSnackBar(mEdtPassword, t.getLocalizedMessage()); // } // // @Override // public void onException(String message) { // mAppUtils.showSnackBar(mEdtPassword, message); // } // // //click event on views // @OnClick({R.id.txtLogin}) // public void onClick() { // boolean isValid = FormValidator.validate(LoginActivity.this, new SimpleErrorPopupCallback(LoginActivity.this)); // if (isValid) { // mLoginPresenter.loginUser(mEdtUserName.getText().toString(), mEdtPassword.getText().toString()); // } // } // }
import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import com.sampleapp.R; import com.sampleapp.module.login.LoginActivity; import java.util.concurrent.TimeUnit; import rx.Observable; import rx.Subscription;
package com.sampleapp.module; /** * Created by saveen_dhiman on 05-November-16. * initial screen for application to present app logo to users */ public class SplashActivity extends AppCompatActivity { private Subscription mSubscriber; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); //start next activity after delay of 2 seconds mSubscriber = Observable.timer(2, TimeUnit.SECONDS).subscribe(aLong -> {
// Path: app/src/main/java/com/sampleapp/module/login/LoginActivity.java // public class LoginActivity extends BaseActivity implements LoginView { // // @Inject // ProgressBarHandler mProgressHandler; // @Inject // LoginPresenter mLoginPresenter; // @Inject // AppUtils mAppUtils; // // @NotEmpty(messageId = R.string.warning_field_empty, order = 1) // @BindView(R.id.edtUserName) // RemoveErrorEditText mEdtUserName; // // @MinLength(value = 6, messageId = R.string.warning_password_length, order = 2) // @BindView(R.id.edtPassword) // RemoveErrorEditText mEdtPassword; // // @Override // protected void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // // //create component // DaggerLoginComponent.builder() // .utilsModule(new UtilsModule(this)) // .loginModule(new LoginModule(this)) // .build().inject(this); // // mLoginPresenter.attachView(this); // } // // //set layout for this activity // @Override // public int getLayout() { // return R.layout.activity_login; // } // // //return intent for this activity // public static Intent createIntent(Context context) { // return new Intent(context, LoginActivity.class); // } // // @Override // public void onLoginSuccess() { // // } // // @Override // public void closeApplication() { // // } // // @Override // public void showProgress() { // mProgressHandler.showProgress(); // } // // @Override // public void hideProgress() { // mProgressHandler.hideProgress(); // } // // @Override // public void onError(Throwable t) { // t.printStackTrace(); // mAppUtils.showSnackBar(mEdtPassword, t.getLocalizedMessage()); // } // // @Override // public void onException(String message) { // mAppUtils.showSnackBar(mEdtPassword, message); // } // // //click event on views // @OnClick({R.id.txtLogin}) // public void onClick() { // boolean isValid = FormValidator.validate(LoginActivity.this, new SimpleErrorPopupCallback(LoginActivity.this)); // if (isValid) { // mLoginPresenter.loginUser(mEdtUserName.getText().toString(), mEdtPassword.getText().toString()); // } // } // } // Path: app/src/main/java/com/sampleapp/module/SplashActivity.java import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import com.sampleapp.R; import com.sampleapp.module.login.LoginActivity; import java.util.concurrent.TimeUnit; import rx.Observable; import rx.Subscription; package com.sampleapp.module; /** * Created by saveen_dhiman on 05-November-16. * initial screen for application to present app logo to users */ public class SplashActivity extends AppCompatActivity { private Subscription mSubscriber; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); //start next activity after delay of 2 seconds mSubscriber = Observable.timer(2, TimeUnit.SECONDS).subscribe(aLong -> {
startActivity(LoginActivity.createIntent(SplashActivity.this));
saveendhiman/SampleApp
app/src/main/java/com/sampleapp/api/RestService.java
// Path: app/src/main/java/com/sampleapp/constants/ApiConstants.java // public interface ApiConstants { // int STATUS_SUCCESS = 200; // String STATUS_SESSION_EXPIRE = "203"; // String BASE_URL = "http://abc.com/"; // String CONTROLLER = "/index.php/webController"; // String LOGIN = CONTROLLER + "/apilogin"; // // } // // Path: app/src/main/java/com/sampleapp/model/request/LoginRequest.java // public class LoginRequest { // // String username; // String password; // String platform; // String deviceid; // // public LoginRequest(@NonNull String username, @NonNull String password, // @NonNull String platform, @NonNull String deviceid) { // this.username = username; // this.password = password; // this.platform = platform; // this.deviceid = deviceid; // } // } // // Path: app/src/main/java/com/sampleapp/model/response/LoginResponse.java // public class LoginResponse { // /** // * result : 1 // * resultText : Success // * errorMSG : Success. // * user_id : 20 // * phone : 1234567890 // * first_name : saveen // * last_name : null // * email : [email protected] // * role : 1 // * avatar : // */ // // private ResponseBean Response; // // public ResponseBean getResponse() { // return Response; // } // // public void setResponse(ResponseBean Response) { // this.Response = Response; // } // // public static class ResponseBean { // private int result; // private String resultText; // private String errorMSG; // private int user_id; // private String phone; // private String first_name; // private Object last_name; // private String email; // private int role; // private String avatar; // // public int getResult() { // return result; // } // // public void setResult(int result) { // this.result = result; // } // // public String getResultText() { // return resultText; // } // // public void setResultText(String resultText) { // this.resultText = resultText; // } // // public String getErrorMSG() { // return errorMSG; // } // // public void setErrorMSG(String errorMSG) { // this.errorMSG = errorMSG; // } // // public int getUser_id() { // return user_id; // } // // public void setUser_id(int user_id) { // this.user_id = user_id; // } // // public String getPhone() { // return phone; // } // // public void setPhone(String phone) { // this.phone = phone; // } // // public String getFirst_name() { // return first_name; // } // // public void setFirst_name(String first_name) { // this.first_name = first_name; // } // // public Object getLast_name() { // return last_name; // } // // public void setLast_name(Object last_name) { // this.last_name = last_name; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // public int getRole() { // return role; // } // // public void setRole(int role) { // this.role = role; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // } // }
import com.sampleapp.constants.ApiConstants; import com.sampleapp.model.request.LoginRequest; import com.sampleapp.model.response.LoginResponse; import retrofit2.http.Body; import retrofit2.http.POST; import rx.Observable;
package com.sampleapp.api; /** * Created by saveen_dhiman on 05-November-16. * Contains API methods to be consumed */ public interface RestService { //LOGIN API @POST(ApiConstants.LOGIN)
// Path: app/src/main/java/com/sampleapp/constants/ApiConstants.java // public interface ApiConstants { // int STATUS_SUCCESS = 200; // String STATUS_SESSION_EXPIRE = "203"; // String BASE_URL = "http://abc.com/"; // String CONTROLLER = "/index.php/webController"; // String LOGIN = CONTROLLER + "/apilogin"; // // } // // Path: app/src/main/java/com/sampleapp/model/request/LoginRequest.java // public class LoginRequest { // // String username; // String password; // String platform; // String deviceid; // // public LoginRequest(@NonNull String username, @NonNull String password, // @NonNull String platform, @NonNull String deviceid) { // this.username = username; // this.password = password; // this.platform = platform; // this.deviceid = deviceid; // } // } // // Path: app/src/main/java/com/sampleapp/model/response/LoginResponse.java // public class LoginResponse { // /** // * result : 1 // * resultText : Success // * errorMSG : Success. // * user_id : 20 // * phone : 1234567890 // * first_name : saveen // * last_name : null // * email : [email protected] // * role : 1 // * avatar : // */ // // private ResponseBean Response; // // public ResponseBean getResponse() { // return Response; // } // // public void setResponse(ResponseBean Response) { // this.Response = Response; // } // // public static class ResponseBean { // private int result; // private String resultText; // private String errorMSG; // private int user_id; // private String phone; // private String first_name; // private Object last_name; // private String email; // private int role; // private String avatar; // // public int getResult() { // return result; // } // // public void setResult(int result) { // this.result = result; // } // // public String getResultText() { // return resultText; // } // // public void setResultText(String resultText) { // this.resultText = resultText; // } // // public String getErrorMSG() { // return errorMSG; // } // // public void setErrorMSG(String errorMSG) { // this.errorMSG = errorMSG; // } // // public int getUser_id() { // return user_id; // } // // public void setUser_id(int user_id) { // this.user_id = user_id; // } // // public String getPhone() { // return phone; // } // // public void setPhone(String phone) { // this.phone = phone; // } // // public String getFirst_name() { // return first_name; // } // // public void setFirst_name(String first_name) { // this.first_name = first_name; // } // // public Object getLast_name() { // return last_name; // } // // public void setLast_name(Object last_name) { // this.last_name = last_name; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // public int getRole() { // return role; // } // // public void setRole(int role) { // this.role = role; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // } // } // Path: app/src/main/java/com/sampleapp/api/RestService.java import com.sampleapp.constants.ApiConstants; import com.sampleapp.model.request.LoginRequest; import com.sampleapp.model.response.LoginResponse; import retrofit2.http.Body; import retrofit2.http.POST; import rx.Observable; package com.sampleapp.api; /** * Created by saveen_dhiman on 05-November-16. * Contains API methods to be consumed */ public interface RestService { //LOGIN API @POST(ApiConstants.LOGIN)
Observable<LoginResponse> login(@Body LoginRequest loginRequest);
saveendhiman/SampleApp
app/src/main/java/com/sampleapp/api/RestService.java
// Path: app/src/main/java/com/sampleapp/constants/ApiConstants.java // public interface ApiConstants { // int STATUS_SUCCESS = 200; // String STATUS_SESSION_EXPIRE = "203"; // String BASE_URL = "http://abc.com/"; // String CONTROLLER = "/index.php/webController"; // String LOGIN = CONTROLLER + "/apilogin"; // // } // // Path: app/src/main/java/com/sampleapp/model/request/LoginRequest.java // public class LoginRequest { // // String username; // String password; // String platform; // String deviceid; // // public LoginRequest(@NonNull String username, @NonNull String password, // @NonNull String platform, @NonNull String deviceid) { // this.username = username; // this.password = password; // this.platform = platform; // this.deviceid = deviceid; // } // } // // Path: app/src/main/java/com/sampleapp/model/response/LoginResponse.java // public class LoginResponse { // /** // * result : 1 // * resultText : Success // * errorMSG : Success. // * user_id : 20 // * phone : 1234567890 // * first_name : saveen // * last_name : null // * email : [email protected] // * role : 1 // * avatar : // */ // // private ResponseBean Response; // // public ResponseBean getResponse() { // return Response; // } // // public void setResponse(ResponseBean Response) { // this.Response = Response; // } // // public static class ResponseBean { // private int result; // private String resultText; // private String errorMSG; // private int user_id; // private String phone; // private String first_name; // private Object last_name; // private String email; // private int role; // private String avatar; // // public int getResult() { // return result; // } // // public void setResult(int result) { // this.result = result; // } // // public String getResultText() { // return resultText; // } // // public void setResultText(String resultText) { // this.resultText = resultText; // } // // public String getErrorMSG() { // return errorMSG; // } // // public void setErrorMSG(String errorMSG) { // this.errorMSG = errorMSG; // } // // public int getUser_id() { // return user_id; // } // // public void setUser_id(int user_id) { // this.user_id = user_id; // } // // public String getPhone() { // return phone; // } // // public void setPhone(String phone) { // this.phone = phone; // } // // public String getFirst_name() { // return first_name; // } // // public void setFirst_name(String first_name) { // this.first_name = first_name; // } // // public Object getLast_name() { // return last_name; // } // // public void setLast_name(Object last_name) { // this.last_name = last_name; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // public int getRole() { // return role; // } // // public void setRole(int role) { // this.role = role; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // } // }
import com.sampleapp.constants.ApiConstants; import com.sampleapp.model.request.LoginRequest; import com.sampleapp.model.response.LoginResponse; import retrofit2.http.Body; import retrofit2.http.POST; import rx.Observable;
package com.sampleapp.api; /** * Created by saveen_dhiman on 05-November-16. * Contains API methods to be consumed */ public interface RestService { //LOGIN API @POST(ApiConstants.LOGIN)
// Path: app/src/main/java/com/sampleapp/constants/ApiConstants.java // public interface ApiConstants { // int STATUS_SUCCESS = 200; // String STATUS_SESSION_EXPIRE = "203"; // String BASE_URL = "http://abc.com/"; // String CONTROLLER = "/index.php/webController"; // String LOGIN = CONTROLLER + "/apilogin"; // // } // // Path: app/src/main/java/com/sampleapp/model/request/LoginRequest.java // public class LoginRequest { // // String username; // String password; // String platform; // String deviceid; // // public LoginRequest(@NonNull String username, @NonNull String password, // @NonNull String platform, @NonNull String deviceid) { // this.username = username; // this.password = password; // this.platform = platform; // this.deviceid = deviceid; // } // } // // Path: app/src/main/java/com/sampleapp/model/response/LoginResponse.java // public class LoginResponse { // /** // * result : 1 // * resultText : Success // * errorMSG : Success. // * user_id : 20 // * phone : 1234567890 // * first_name : saveen // * last_name : null // * email : [email protected] // * role : 1 // * avatar : // */ // // private ResponseBean Response; // // public ResponseBean getResponse() { // return Response; // } // // public void setResponse(ResponseBean Response) { // this.Response = Response; // } // // public static class ResponseBean { // private int result; // private String resultText; // private String errorMSG; // private int user_id; // private String phone; // private String first_name; // private Object last_name; // private String email; // private int role; // private String avatar; // // public int getResult() { // return result; // } // // public void setResult(int result) { // this.result = result; // } // // public String getResultText() { // return resultText; // } // // public void setResultText(String resultText) { // this.resultText = resultText; // } // // public String getErrorMSG() { // return errorMSG; // } // // public void setErrorMSG(String errorMSG) { // this.errorMSG = errorMSG; // } // // public int getUser_id() { // return user_id; // } // // public void setUser_id(int user_id) { // this.user_id = user_id; // } // // public String getPhone() { // return phone; // } // // public void setPhone(String phone) { // this.phone = phone; // } // // public String getFirst_name() { // return first_name; // } // // public void setFirst_name(String first_name) { // this.first_name = first_name; // } // // public Object getLast_name() { // return last_name; // } // // public void setLast_name(Object last_name) { // this.last_name = last_name; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // // public int getRole() { // return role; // } // // public void setRole(int role) { // this.role = role; // } // // public String getAvatar() { // return avatar; // } // // public void setAvatar(String avatar) { // this.avatar = avatar; // } // } // } // Path: app/src/main/java/com/sampleapp/api/RestService.java import com.sampleapp.constants.ApiConstants; import com.sampleapp.model.request.LoginRequest; import com.sampleapp.model.response.LoginResponse; import retrofit2.http.Body; import retrofit2.http.POST; import rx.Observable; package com.sampleapp.api; /** * Created by saveen_dhiman on 05-November-16. * Contains API methods to be consumed */ public interface RestService { //LOGIN API @POST(ApiConstants.LOGIN)
Observable<LoginResponse> login(@Body LoginRequest loginRequest);
saveendhiman/SampleApp
app/src/main/java/com/sampleapp/utils/LocationTracker.java
// Path: app/src/main/java/com/sampleapp/base/SampleApplication.java // public class SampleApplication extends Application { // // private AppComponent mAppComponent; // // @Override // public void onCreate() { // super.onCreate(); // Fabric.with(this, new Crashlytics()); // // //create component // mAppComponent = DaggerAppComponent.builder() // .utilsModule(new UtilsModule(this)).build(); // // //configure timber for logging // if (BuildConfig.DEBUG) { // Timber.plant(new Timber.DebugTree()); // } // } // // public AppComponent getAppComponent() { // return mAppComponent; // } // }
import android.content.Context; import android.location.Location; import android.os.Bundle; import android.support.annotation.NonNull; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.location.LocationListener; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationServices; import com.sampleapp.R; import com.sampleapp.base.SampleApplication; import javax.inject.Inject; import timber.log.Timber;
package com.sampleapp.utils; @SuppressWarnings("MissingPermission") public class LocationTracker implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { private Context context; private GoogleApiClient mGoogleApiClient; private static int UPDATE_INTERVAL = 0; private static int FATEST_INTERVAL = 0; private static int DISPLACEMENT = 2000; // 2KM private LocationRequest mLocationRequest; private Location mLastLocation; private onLocationListener listener; @Inject AppUtils mAppUtils; public LocationTracker(Context context) { this.context = context;
// Path: app/src/main/java/com/sampleapp/base/SampleApplication.java // public class SampleApplication extends Application { // // private AppComponent mAppComponent; // // @Override // public void onCreate() { // super.onCreate(); // Fabric.with(this, new Crashlytics()); // // //create component // mAppComponent = DaggerAppComponent.builder() // .utilsModule(new UtilsModule(this)).build(); // // //configure timber for logging // if (BuildConfig.DEBUG) { // Timber.plant(new Timber.DebugTree()); // } // } // // public AppComponent getAppComponent() { // return mAppComponent; // } // } // Path: app/src/main/java/com/sampleapp/utils/LocationTracker.java import android.content.Context; import android.location.Location; import android.os.Bundle; import android.support.annotation.NonNull; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.location.LocationListener; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationServices; import com.sampleapp.R; import com.sampleapp.base.SampleApplication; import javax.inject.Inject; import timber.log.Timber; package com.sampleapp.utils; @SuppressWarnings("MissingPermission") public class LocationTracker implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { private Context context; private GoogleApiClient mGoogleApiClient; private static int UPDATE_INTERVAL = 0; private static int FATEST_INTERVAL = 0; private static int DISPLACEMENT = 2000; // 2KM private LocationRequest mLocationRequest; private Location mLastLocation; private onLocationListener listener; @Inject AppUtils mAppUtils; public LocationTracker(Context context) { this.context = context;
((SampleApplication)context).getAppComponent().inject(this);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/inscriptions/InscriptionBlink.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.io.IOException; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils;
package xilef11.mc.runesofwizardry_classics.inscriptions; public class InscriptionBlink extends ClassicInscription { @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/inscriptions/InscriptionBlink.java import java.io.IOException; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils; package xilef11.mc.runesofwizardry_classics.inscriptions; public class InscriptionBlink extends ClassicInscription { @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(new ResourceLocation(Refs.MODID,"patterns/inscriptions/inscriptionblink.json"));
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/inscriptions/InscriptionBlink.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.io.IOException; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils;
package xilef11.mc.runesofwizardry_classics.inscriptions; public class InscriptionBlink extends ClassicInscription { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(new ResourceLocation(Refs.MODID,"patterns/inscriptions/inscriptionblink.json")); } @Override protected ItemStack[] setupChargeItems() { return new ItemStack[]{ new ItemStack(Items.ENDER_PEARL,8), new ItemStack(Blocks.QUARTZ_BLOCK), new ItemStack(Items.BLAZE_ROD,2) };//10 XP } @Override public String getID() { return "blink"; } /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.inscriptions.ClassicInscription#hasExtraSacrifice() */ @Override protected boolean hasExtraSacrifice() { return true; } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.Inscription#onInscriptionCharged(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) */ @Override public boolean onInscriptionCharged(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { if(!player.world.isRemote){ if(!negated){
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/inscriptions/InscriptionBlink.java import java.io.IOException; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils; package xilef11.mc.runesofwizardry_classics.inscriptions; public class InscriptionBlink extends ClassicInscription { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(new ResourceLocation(Refs.MODID,"patterns/inscriptions/inscriptionblink.json")); } @Override protected ItemStack[] setupChargeItems() { return new ItemStack[]{ new ItemStack(Items.ENDER_PEARL,8), new ItemStack(Blocks.QUARTZ_BLOCK), new ItemStack(Items.BLAZE_ROD,2) };//10 XP } @Override public String getID() { return "blink"; } /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.inscriptions.ClassicInscription#hasExtraSacrifice() */ @Override protected boolean hasExtraSacrifice() { return true; } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.Inscription#onInscriptionCharged(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) */ @Override public boolean onInscriptionCharged(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { if(!player.world.isRemote){ if(!negated){
return Utils.takeXP(player, 10);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneLeapingFrog.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityLeapingFrog.java // public class RuneEntityLeapingFrog extends RuneEntity { // public RuneEntityLeapingFrog(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, // TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // //start FX // entity.setupStar(0xFFFFFF, 0x00FF00, 1, 1); // entity.setDrawStar(true); // } // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote){ // if(entity.ticksExisted()%10==0){ // BlockPos current = getPos().offset(face, 1+blocksplaced); // //Block down = world.getBlockState(current.down()).getBlock(); // if(world.isAirBlock(current)&&world.containsAnyLiquid(new AxisAlignedBB(current.down(), current.down().add(1, 1, 1)))){ // //world.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, current.getX(), current.getY(), current.getZ(), 0.5, 0.5, 0.5); // if(world instanceof WorldServer){ // WorldServer ws = (WorldServer)world; // ws.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, current.getX()+0.5, current.getY()+0.5, current.getZ()+0.5, ws.rand.nextInt(3)+2, 0,0,0, 2d); // } // world.setBlockState(current, Blocks.WATERLILY.getDefaultState()); // world.playBroadcastSound(2005, current, 0); // world.playSound(null, current, SoundEvents.BLOCK_GRASS_STEP, SoundCategory.BLOCKS, 0.7F, 0.6F); // blocksplaced++; // }else{ // this.onPatternBroken();//we're done // } // } // } // } // private int blocksplaced=0; // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void readFromNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // blocksplaced = compound.getInteger("runeFrog.blocksplaced"); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void writeToNBT(NBTTagCompound compound) { // super.writeToNBT(compound); // compound.setInteger("runeFrog.blocksplaced",blocksplaced); // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityLeapingFrog;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneLeapingFrog extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityLeapingFrog.java // public class RuneEntityLeapingFrog extends RuneEntity { // public RuneEntityLeapingFrog(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, // TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // //start FX // entity.setupStar(0xFFFFFF, 0x00FF00, 1, 1); // entity.setDrawStar(true); // } // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote){ // if(entity.ticksExisted()%10==0){ // BlockPos current = getPos().offset(face, 1+blocksplaced); // //Block down = world.getBlockState(current.down()).getBlock(); // if(world.isAirBlock(current)&&world.containsAnyLiquid(new AxisAlignedBB(current.down(), current.down().add(1, 1, 1)))){ // //world.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, current.getX(), current.getY(), current.getZ(), 0.5, 0.5, 0.5); // if(world instanceof WorldServer){ // WorldServer ws = (WorldServer)world; // ws.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, current.getX()+0.5, current.getY()+0.5, current.getZ()+0.5, ws.rand.nextInt(3)+2, 0,0,0, 2d); // } // world.setBlockState(current, Blocks.WATERLILY.getDefaultState()); // world.playBroadcastSound(2005, current, 0); // world.playSound(null, current, SoundEvents.BLOCK_GRASS_STEP, SoundCategory.BLOCKS, 0.7F, 0.6F); // blocksplaced++; // }else{ // this.onPatternBroken();//we're done // } // } // } // } // private int blocksplaced=0; // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void readFromNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // blocksplaced = compound.getInteger("runeFrog.blocksplaced"); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void writeToNBT(NBTTagCompound compound) { // super.writeToNBT(compound); // compound.setInteger("runeFrog.blocksplaced",blocksplaced); // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneLeapingFrog.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityLeapingFrog; package xilef11.mc.runesofwizardry_classics.runes; public class RuneLeapingFrog extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runeleapingfrog.json");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneLeapingFrog.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityLeapingFrog.java // public class RuneEntityLeapingFrog extends RuneEntity { // public RuneEntityLeapingFrog(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, // TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // //start FX // entity.setupStar(0xFFFFFF, 0x00FF00, 1, 1); // entity.setDrawStar(true); // } // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote){ // if(entity.ticksExisted()%10==0){ // BlockPos current = getPos().offset(face, 1+blocksplaced); // //Block down = world.getBlockState(current.down()).getBlock(); // if(world.isAirBlock(current)&&world.containsAnyLiquid(new AxisAlignedBB(current.down(), current.down().add(1, 1, 1)))){ // //world.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, current.getX(), current.getY(), current.getZ(), 0.5, 0.5, 0.5); // if(world instanceof WorldServer){ // WorldServer ws = (WorldServer)world; // ws.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, current.getX()+0.5, current.getY()+0.5, current.getZ()+0.5, ws.rand.nextInt(3)+2, 0,0,0, 2d); // } // world.setBlockState(current, Blocks.WATERLILY.getDefaultState()); // world.playBroadcastSound(2005, current, 0); // world.playSound(null, current, SoundEvents.BLOCK_GRASS_STEP, SoundCategory.BLOCKS, 0.7F, 0.6F); // blocksplaced++; // }else{ // this.onPatternBroken();//we're done // } // } // } // } // private int blocksplaced=0; // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void readFromNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // blocksplaced = compound.getInteger("runeFrog.blocksplaced"); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void writeToNBT(NBTTagCompound compound) { // super.writeToNBT(compound); // compound.setInteger("runeFrog.blocksplaced",blocksplaced); // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityLeapingFrog;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneLeapingFrog extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runeleapingfrog.json"); } @Override public String getID() { return "runeLeapingFrog"; } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,0,0); } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Blocks.LEAVES,4)} }; } @Override public String getName() { return Refs.Lang.RUNE+".leapingfrog"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityLeapingFrog.java // public class RuneEntityLeapingFrog extends RuneEntity { // public RuneEntityLeapingFrog(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, // TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // //start FX // entity.setupStar(0xFFFFFF, 0x00FF00, 1, 1); // entity.setDrawStar(true); // } // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote){ // if(entity.ticksExisted()%10==0){ // BlockPos current = getPos().offset(face, 1+blocksplaced); // //Block down = world.getBlockState(current.down()).getBlock(); // if(world.isAirBlock(current)&&world.containsAnyLiquid(new AxisAlignedBB(current.down(), current.down().add(1, 1, 1)))){ // //world.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, current.getX(), current.getY(), current.getZ(), 0.5, 0.5, 0.5); // if(world instanceof WorldServer){ // WorldServer ws = (WorldServer)world; // ws.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, current.getX()+0.5, current.getY()+0.5, current.getZ()+0.5, ws.rand.nextInt(3)+2, 0,0,0, 2d); // } // world.setBlockState(current, Blocks.WATERLILY.getDefaultState()); // world.playBroadcastSound(2005, current, 0); // world.playSound(null, current, SoundEvents.BLOCK_GRASS_STEP, SoundCategory.BLOCKS, 0.7F, 0.6F); // blocksplaced++; // }else{ // this.onPatternBroken();//we're done // } // } // } // } // private int blocksplaced=0; // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void readFromNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // blocksplaced = compound.getInteger("runeFrog.blocksplaced"); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void writeToNBT(NBTTagCompound compound) { // super.writeToNBT(compound); // compound.setInteger("runeFrog.blocksplaced",blocksplaced); // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneLeapingFrog.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityLeapingFrog; package xilef11.mc.runesofwizardry_classics.runes; public class RuneLeapingFrog extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runeleapingfrog.json"); } @Override public String getID() { return "runeLeapingFrog"; } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,0,0); } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Blocks.LEAVES,4)} }; } @Override public String getName() { return Refs.Lang.RUNE+".leapingfrog"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
return new RuneEntityLeapingFrog(actualPattern, front, dusts, entity, this);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneMusic.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityMusic.java // public class RuneEntityMusic extends RuneEntity { // /** // * @param actualPattern // * @param facing // * @param dusts // * @param entity // */ // public RuneEntityMusic(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { // super(actualPattern, facing, dusts, entity,creator); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) // */ // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#update() // */ // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote && entity.ticksExisted()==Refs.TPS*5){ // //grab the list of records // //Map<String,ItemRecord> recordMap = ReflectionHelper.getPrivateValue(ItemRecord.class, (ItemRecord)Items.RECORD_13, "RECORDS","field_150928_b"); // Map<String,ItemRecord> recordMap = ObfuscationReflectionHelper.getPrivateValue(ItemRecord.class, (ItemRecord)Items.RECORD_13,"field_150928_b"); // Collection<ItemRecord> records = recordMap.values(); // //select a random number // Random rand = new Random(); // int idx = rand.nextInt(records.size()); // //grab the record that matches our random number // Iterator<ItemRecord> it = records.iterator(); // ItemRecord current=it.next(); // for(int i=1;i<idx;i++){ // current = it.next(); // } // //spawn the record // Utils.spawnItemCentered(world, getPos(), new ItemStack(current)); // //world.playSoundEffect(getPos().getX(), getPos().getY(), getPos().getZ(), "mob.chicken.plop", 0.5F, 0.8F + (world.rand.nextFloat() - world.rand.nextFloat())); // world.playSound(null,getPos().getX(), getPos().getY(), getPos().getZ(), SoundEvents.ENTITY_CHICKEN_EGG, SoundCategory.BLOCKS, 0.5F, 0.8F + (world.rand.nextFloat() - world.rand.nextFloat())); // this.onPatternBroken();//deactivate // } // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityMusic;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneMusic extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityMusic.java // public class RuneEntityMusic extends RuneEntity { // /** // * @param actualPattern // * @param facing // * @param dusts // * @param entity // */ // public RuneEntityMusic(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { // super(actualPattern, facing, dusts, entity,creator); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) // */ // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#update() // */ // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote && entity.ticksExisted()==Refs.TPS*5){ // //grab the list of records // //Map<String,ItemRecord> recordMap = ReflectionHelper.getPrivateValue(ItemRecord.class, (ItemRecord)Items.RECORD_13, "RECORDS","field_150928_b"); // Map<String,ItemRecord> recordMap = ObfuscationReflectionHelper.getPrivateValue(ItemRecord.class, (ItemRecord)Items.RECORD_13,"field_150928_b"); // Collection<ItemRecord> records = recordMap.values(); // //select a random number // Random rand = new Random(); // int idx = rand.nextInt(records.size()); // //grab the record that matches our random number // Iterator<ItemRecord> it = records.iterator(); // ItemRecord current=it.next(); // for(int i=1;i<idx;i++){ // current = it.next(); // } // //spawn the record // Utils.spawnItemCentered(world, getPos(), new ItemStack(current)); // //world.playSoundEffect(getPos().getX(), getPos().getY(), getPos().getZ(), "mob.chicken.plop", 0.5F, 0.8F + (world.rand.nextFloat() - world.rand.nextFloat())); // world.playSound(null,getPos().getX(), getPos().getY(), getPos().getZ(), SoundEvents.ENTITY_CHICKEN_EGG, SoundCategory.BLOCKS, 0.5F, 0.8F + (world.rand.nextFloat() - world.rand.nextFloat())); // this.onPatternBroken();//deactivate // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneMusic.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityMusic; package xilef11.mc.runesofwizardry_classics.runes; public class RuneMusic extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runemusic.json");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneMusic.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityMusic.java // public class RuneEntityMusic extends RuneEntity { // /** // * @param actualPattern // * @param facing // * @param dusts // * @param entity // */ // public RuneEntityMusic(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { // super(actualPattern, facing, dusts, entity,creator); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) // */ // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#update() // */ // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote && entity.ticksExisted()==Refs.TPS*5){ // //grab the list of records // //Map<String,ItemRecord> recordMap = ReflectionHelper.getPrivateValue(ItemRecord.class, (ItemRecord)Items.RECORD_13, "RECORDS","field_150928_b"); // Map<String,ItemRecord> recordMap = ObfuscationReflectionHelper.getPrivateValue(ItemRecord.class, (ItemRecord)Items.RECORD_13,"field_150928_b"); // Collection<ItemRecord> records = recordMap.values(); // //select a random number // Random rand = new Random(); // int idx = rand.nextInt(records.size()); // //grab the record that matches our random number // Iterator<ItemRecord> it = records.iterator(); // ItemRecord current=it.next(); // for(int i=1;i<idx;i++){ // current = it.next(); // } // //spawn the record // Utils.spawnItemCentered(world, getPos(), new ItemStack(current)); // //world.playSoundEffect(getPos().getX(), getPos().getY(), getPos().getZ(), "mob.chicken.plop", 0.5F, 0.8F + (world.rand.nextFloat() - world.rand.nextFloat())); // world.playSound(null,getPos().getX(), getPos().getY(), getPos().getZ(), SoundEvents.ENTITY_CHICKEN_EGG, SoundCategory.BLOCKS, 0.5F, 0.8F + (world.rand.nextFloat() - world.rand.nextFloat())); // this.onPatternBroken();//deactivate // } // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityMusic;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneMusic extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runemusic.json"); } @Override protected Vec3i setupEntityPos() { return new Vec3i(0,0,0); } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Items.DIAMOND)} }; } @Override public String getName() { return Refs.Lang.RUNE+".music"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityMusic.java // public class RuneEntityMusic extends RuneEntity { // /** // * @param actualPattern // * @param facing // * @param dusts // * @param entity // */ // public RuneEntityMusic(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { // super(actualPattern, facing, dusts, entity,creator); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) // */ // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#update() // */ // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote && entity.ticksExisted()==Refs.TPS*5){ // //grab the list of records // //Map<String,ItemRecord> recordMap = ReflectionHelper.getPrivateValue(ItemRecord.class, (ItemRecord)Items.RECORD_13, "RECORDS","field_150928_b"); // Map<String,ItemRecord> recordMap = ObfuscationReflectionHelper.getPrivateValue(ItemRecord.class, (ItemRecord)Items.RECORD_13,"field_150928_b"); // Collection<ItemRecord> records = recordMap.values(); // //select a random number // Random rand = new Random(); // int idx = rand.nextInt(records.size()); // //grab the record that matches our random number // Iterator<ItemRecord> it = records.iterator(); // ItemRecord current=it.next(); // for(int i=1;i<idx;i++){ // current = it.next(); // } // //spawn the record // Utils.spawnItemCentered(world, getPos(), new ItemStack(current)); // //world.playSoundEffect(getPos().getX(), getPos().getY(), getPos().getZ(), "mob.chicken.plop", 0.5F, 0.8F + (world.rand.nextFloat() - world.rand.nextFloat())); // world.playSound(null,getPos().getX(), getPos().getY(), getPos().getZ(), SoundEvents.ENTITY_CHICKEN_EGG, SoundCategory.BLOCKS, 0.5F, 0.8F + (world.rand.nextFloat() - world.rand.nextFloat())); // this.onPatternBroken();//deactivate // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneMusic.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityMusic; package xilef11.mc.runesofwizardry_classics.runes; public class RuneMusic extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runemusic.json"); } @Override protected Vec3i setupEntityPos() { return new Vec3i(0,0,0); } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Items.DIAMOND)} }; } @Override public String getName() { return Refs.Lang.RUNE+".music"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
return new RuneEntityMusic(actualPattern, front, dusts, entity,this);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/managers/TeleportationData.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // }
import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.storage.MapStorage; import net.minecraft.world.storage.WorldSavedData; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics;
package xilef11.mc.runesofwizardry_classics.managers; /** * Manages and save the data for teleportation network * @see http://mcforge.readthedocs.org/en/latest/datastorage/worldsaveddata/ * @author Xilef11 * */ public class TeleportationData extends WorldSavedData { private static final String DATA_NAME = Refs.MODID + "_TeleportationData"; public TeleportationData(){ this(DATA_NAME); } public TeleportationData(String name) { super(name); } /** * Get the saved teleportation data for a world (or a new instance if there is none) * @param world the world for which to get the teleportation network data * @return the (possibly empty) teleportation network data for a world */ public static TeleportationData get(World world) { MapStorage storage = world.getPerWorldStorage(); TeleportationData instance = (TeleportationData) storage.getOrLoadData(TeleportationData.class, DATA_NAME); if (instance == null) { instance = new TeleportationData(); storage.setData(DATA_NAME, instance); } return instance; } //the key is the "id" of a blockstate in the form blockid@meta private Map<String,Set<BlockPos>> networks = new HashMap<>(); /** * Adds a teleport location to a network * @param state the BlockState that identifies the network * @param pos the position to add to the network */ public void registerLocation(IBlockState state, BlockPos pos){ //get the key for this blockstate String key = getStateID(state); //add the position for this state addLocation(key, pos); this.markDirty(); /*markDirty here instead of in addLocation * because addLocation is called when reading from NBT (which is not a change in the data) * maybe add it to readFromNBT if saving doesn't work properly on servers */ } /** * Removes a teleport location from a network * @param state the BlockState that identifies the network * @param pos the position to remove from the network */ public void removeLocation(IBlockState state, BlockPos pos){ String key = getStateID(state); Set<BlockPos> locations = networks.get(key); if(locations!=null){ locations.remove(pos); }else{
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/managers/TeleportationData.java import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.storage.MapStorage; import net.minecraft.world.storage.WorldSavedData; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics; package xilef11.mc.runesofwizardry_classics.managers; /** * Manages and save the data for teleportation network * @see http://mcforge.readthedocs.org/en/latest/datastorage/worldsaveddata/ * @author Xilef11 * */ public class TeleportationData extends WorldSavedData { private static final String DATA_NAME = Refs.MODID + "_TeleportationData"; public TeleportationData(){ this(DATA_NAME); } public TeleportationData(String name) { super(name); } /** * Get the saved teleportation data for a world (or a new instance if there is none) * @param world the world for which to get the teleportation network data * @return the (possibly empty) teleportation network data for a world */ public static TeleportationData get(World world) { MapStorage storage = world.getPerWorldStorage(); TeleportationData instance = (TeleportationData) storage.getOrLoadData(TeleportationData.class, DATA_NAME); if (instance == null) { instance = new TeleportationData(); storage.setData(DATA_NAME, instance); } return instance; } //the key is the "id" of a blockstate in the form blockid@meta private Map<String,Set<BlockPos>> networks = new HashMap<>(); /** * Adds a teleport location to a network * @param state the BlockState that identifies the network * @param pos the position to add to the network */ public void registerLocation(IBlockState state, BlockPos pos){ //get the key for this blockstate String key = getStateID(state); //add the position for this state addLocation(key, pos); this.markDirty(); /*markDirty here instead of in addLocation * because addLocation is called when reading from NBT (which is not a change in the data) * maybe add it to readFromNBT if saving doesn't work properly on servers */ } /** * Removes a teleport location from a network * @param state the BlockState that identifies the network * @param pos the position to remove from the network */ public void removeLocation(IBlockState state, BlockPos pos){ String key = getStateID(state); Set<BlockPos> locations = networks.get(key); if(locations!=null){ locations.remove(pos); }else{
RunesofWizardry_Classics.log().warn("Trying to remove a teleport destination with inexistant key: "+key+" for state: "+state+" at pos: ");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneHellstorm.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityHellstorm.java // public class RuneEntityHellstorm extends FueledRuneEntity { // public RuneEntityHellstorm(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // protected int initialTicks() { // return Refs.TICKS_PER_DAY/2; // } // // /* (non-Javadoc) // * @see xilef11.mc.runesofwizardry_classics.runes.entity.FueledRuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) // */ // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // super.onRuneActivatedbyPlayer(player, sacrifice, negated); // entity.setupStar(0xFFFFFF, 0xFF0000, 1, 1,new Vec3d(0,-0.9,0)); // entity.setDrawStar(true); // entity.setupBeam(0xFF0000, BeamType.SPIRAL); // } // // //original radius was 100 blocks, with 20 arrows every 5 ticks // private static final int RAD=32,AMOUNT=6,TICKRATE=7; // /* (non-Javadoc) // * @see xilef11.mc.runesofwizardry_classics.runes.entity.FueledRuneEntity#update() // */ // @Override // public void update() { // super.update(); // World world = entity.getWorld(); // if(!world.isRemote && entity.ticksExisted()%TICKRATE==0){ // BlockPos pos = getPos(); // for(int i=0;i<AMOUNT;i++){ // double x = pos.getX()+Math.random() * RAD * 2 - RAD, // z = pos.getZ()+Math.random() * RAD * 2 - RAD; // BlockPos spawn = new BlockPos(x,pos.getY()+94,z); // while(!world.isAirBlock(spawn)&&spawn.getY()>pos.getY()+1)spawn=spawn.down(); // //Original spawned arrows at a fixed height of 158 // EntityArrow arrow = new EntityTippedArrow(world, x, spawn.getY(), z); // arrow.motionX=0; // arrow.motionZ=0; // arrow.motionY=-2D; // arrow.setFire(30); // arrow.pickupStatus=PickupStatus.DISALLOWED;//why is this an int... // //arrow.setThrowableHeading(0, -1, 0, 2F, 0); // world.spawnEntity(arrow); // } // } // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityHellstorm;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneHellstorm extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityHellstorm.java // public class RuneEntityHellstorm extends FueledRuneEntity { // public RuneEntityHellstorm(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // protected int initialTicks() { // return Refs.TICKS_PER_DAY/2; // } // // /* (non-Javadoc) // * @see xilef11.mc.runesofwizardry_classics.runes.entity.FueledRuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) // */ // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // super.onRuneActivatedbyPlayer(player, sacrifice, negated); // entity.setupStar(0xFFFFFF, 0xFF0000, 1, 1,new Vec3d(0,-0.9,0)); // entity.setDrawStar(true); // entity.setupBeam(0xFF0000, BeamType.SPIRAL); // } // // //original radius was 100 blocks, with 20 arrows every 5 ticks // private static final int RAD=32,AMOUNT=6,TICKRATE=7; // /* (non-Javadoc) // * @see xilef11.mc.runesofwizardry_classics.runes.entity.FueledRuneEntity#update() // */ // @Override // public void update() { // super.update(); // World world = entity.getWorld(); // if(!world.isRemote && entity.ticksExisted()%TICKRATE==0){ // BlockPos pos = getPos(); // for(int i=0;i<AMOUNT;i++){ // double x = pos.getX()+Math.random() * RAD * 2 - RAD, // z = pos.getZ()+Math.random() * RAD * 2 - RAD; // BlockPos spawn = new BlockPos(x,pos.getY()+94,z); // while(!world.isAirBlock(spawn)&&spawn.getY()>pos.getY()+1)spawn=spawn.down(); // //Original spawned arrows at a fixed height of 158 // EntityArrow arrow = new EntityTippedArrow(world, x, spawn.getY(), z); // arrow.motionX=0; // arrow.motionZ=0; // arrow.motionY=-2D; // arrow.setFire(30); // arrow.pickupStatus=PickupStatus.DISALLOWED;//why is this an int... // //arrow.setThrowableHeading(0, -1, 0, 2F, 0); // world.spawnEntity(arrow); // } // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneHellstorm.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityHellstorm; package xilef11.mc.runesofwizardry_classics.runes; public class RuneHellstorm extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runehellstorm.json");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneHellstorm.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityHellstorm.java // public class RuneEntityHellstorm extends FueledRuneEntity { // public RuneEntityHellstorm(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // protected int initialTicks() { // return Refs.TICKS_PER_DAY/2; // } // // /* (non-Javadoc) // * @see xilef11.mc.runesofwizardry_classics.runes.entity.FueledRuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) // */ // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // super.onRuneActivatedbyPlayer(player, sacrifice, negated); // entity.setupStar(0xFFFFFF, 0xFF0000, 1, 1,new Vec3d(0,-0.9,0)); // entity.setDrawStar(true); // entity.setupBeam(0xFF0000, BeamType.SPIRAL); // } // // //original radius was 100 blocks, with 20 arrows every 5 ticks // private static final int RAD=32,AMOUNT=6,TICKRATE=7; // /* (non-Javadoc) // * @see xilef11.mc.runesofwizardry_classics.runes.entity.FueledRuneEntity#update() // */ // @Override // public void update() { // super.update(); // World world = entity.getWorld(); // if(!world.isRemote && entity.ticksExisted()%TICKRATE==0){ // BlockPos pos = getPos(); // for(int i=0;i<AMOUNT;i++){ // double x = pos.getX()+Math.random() * RAD * 2 - RAD, // z = pos.getZ()+Math.random() * RAD * 2 - RAD; // BlockPos spawn = new BlockPos(x,pos.getY()+94,z); // while(!world.isAirBlock(spawn)&&spawn.getY()>pos.getY()+1)spawn=spawn.down(); // //Original spawned arrows at a fixed height of 158 // EntityArrow arrow = new EntityTippedArrow(world, x, spawn.getY(), z); // arrow.motionX=0; // arrow.motionZ=0; // arrow.motionY=-2D; // arrow.setFire(30); // arrow.pickupStatus=PickupStatus.DISALLOWED;//why is this an int... // //arrow.setThrowableHeading(0, -1, 0, 2F, 0); // world.spawnEntity(arrow); // } // } // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityHellstorm;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneHellstorm extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runehellstorm.json"); } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,1,0); } @Override public String getID() { return "runeHellstorm"; } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Items.BLAZE_ROD,2)} }; } @Override public String getName() { return Refs.Lang.RUNE+".hellstorm"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityHellstorm.java // public class RuneEntityHellstorm extends FueledRuneEntity { // public RuneEntityHellstorm(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // protected int initialTicks() { // return Refs.TICKS_PER_DAY/2; // } // // /* (non-Javadoc) // * @see xilef11.mc.runesofwizardry_classics.runes.entity.FueledRuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) // */ // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // super.onRuneActivatedbyPlayer(player, sacrifice, negated); // entity.setupStar(0xFFFFFF, 0xFF0000, 1, 1,new Vec3d(0,-0.9,0)); // entity.setDrawStar(true); // entity.setupBeam(0xFF0000, BeamType.SPIRAL); // } // // //original radius was 100 blocks, with 20 arrows every 5 ticks // private static final int RAD=32,AMOUNT=6,TICKRATE=7; // /* (non-Javadoc) // * @see xilef11.mc.runesofwizardry_classics.runes.entity.FueledRuneEntity#update() // */ // @Override // public void update() { // super.update(); // World world = entity.getWorld(); // if(!world.isRemote && entity.ticksExisted()%TICKRATE==0){ // BlockPos pos = getPos(); // for(int i=0;i<AMOUNT;i++){ // double x = pos.getX()+Math.random() * RAD * 2 - RAD, // z = pos.getZ()+Math.random() * RAD * 2 - RAD; // BlockPos spawn = new BlockPos(x,pos.getY()+94,z); // while(!world.isAirBlock(spawn)&&spawn.getY()>pos.getY()+1)spawn=spawn.down(); // //Original spawned arrows at a fixed height of 158 // EntityArrow arrow = new EntityTippedArrow(world, x, spawn.getY(), z); // arrow.motionX=0; // arrow.motionZ=0; // arrow.motionY=-2D; // arrow.setFire(30); // arrow.pickupStatus=PickupStatus.DISALLOWED;//why is this an int... // //arrow.setThrowableHeading(0, -1, 0, 2F, 0); // world.spawnEntity(arrow); // } // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneHellstorm.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityHellstorm; package xilef11.mc.runesofwizardry_classics.runes; public class RuneHellstorm extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runehellstorm.json"); } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,1,0); } @Override public String getID() { return "runeHellstorm"; } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Items.BLAZE_ROD,2)} }; } @Override public String getName() { return Refs.Lang.RUNE+".hellstorm"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
return new RuneEntityHellstorm(actualPattern, front, dusts, entity, this);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityRebirth.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing.AxisDirection; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils;
break; case Z:z=offset*dir; break; } entity.setupStar(0xFFFFFF, 0xFFFFFF,1,1,new Vec3d(x, y, z)); entity.setDrawStar(true); } } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#update() */ @Override public void update() { // not much here } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#handleEntityCollision(net.minecraft.world.World, net.minecraft.util.BlockPos, net.minecraft.block.state.IBlockState, net.minecraft.entity.Entity) */ @Override public boolean handleEntityCollision(World worldIn, BlockPos pos,IBlockState state, Entity entityIn) { if(!worldIn.isRemote){ if((entityIn instanceof EntityLivingBase) && !(entityIn instanceof EntityPlayer)&&!(entityIn instanceof EntityArmorStand)){ ResourceLocation entID = EntityList.getKey(entityIn); //check if a spawn egg exists TODO also config blacklist? if(EntityList.ENTITY_EGGS.get(entID)!=null){ ItemStack egg = new ItemStack(Items.SPAWN_EGG); NBTTagCompound entityTag = new NBTTagCompound(); entityTag.setString("id", entID.toString()); egg.setTagInfo("EntityTag", entityTag);
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityRebirth.java import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing.AxisDirection; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils; break; case Z:z=offset*dir; break; } entity.setupStar(0xFFFFFF, 0xFFFFFF,1,1,new Vec3d(x, y, z)); entity.setDrawStar(true); } } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#update() */ @Override public void update() { // not much here } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#handleEntityCollision(net.minecraft.world.World, net.minecraft.util.BlockPos, net.minecraft.block.state.IBlockState, net.minecraft.entity.Entity) */ @Override public boolean handleEntityCollision(World worldIn, BlockPos pos,IBlockState state, Entity entityIn) { if(!worldIn.isRemote){ if((entityIn instanceof EntityLivingBase) && !(entityIn instanceof EntityPlayer)&&!(entityIn instanceof EntityArmorStand)){ ResourceLocation entID = EntityList.getKey(entityIn); //check if a spawn egg exists TODO also config blacklist? if(EntityList.ENTITY_EGGS.get(entID)!=null){ ItemStack egg = new ItemStack(Items.SPAWN_EGG); NBTTagCompound entityTag = new NBTTagCompound(); entityTag.setString("id", entID.toString()); egg.setTagInfo("EntityTag", entityTag);
Utils.spawnItemCentered(worldIn, pos, egg);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneEnchantingSilkTouch.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityEnchantingSilktouch.java // public class RuneEntityEnchantingSilktouch extends RuneEntity { // public RuneEntityEnchantingSilktouch(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, // TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // if(negated || Utils.takeXP(player, 10)){ // //find the bow stack // ItemStack toEnchant=ItemStack.EMPTY; // if(sacrifice!=null){ // for(ItemStack i:sacrifice){ // if(i.getItem()==Items.DIAMOND_PICKAXE || i.getItem()==Items.DIAMOND_SHOVEL){ // toEnchant=i; // } // } // } // if(toEnchant.isEmpty() && negated)toEnchant=new ItemStack(Items.DIAMOND_PICKAXE); // toEnchant.addEnchantment(Enchantments.SILK_TOUCH, Enchantments.SILK_TOUCH.getMaxLevel()); // toEnchant.setItemDamage(0); // Utils.spawnItemCentered(world, getPos(), toEnchant); // this.onPatternBroken(); // }else{ // this.onPatternBrokenByPlayer(player); // } // } // } // @Override // public void update() { // //not much until FX // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import net.minecraftforge.oredict.OreDictionary; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityEnchantingSilktouch;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneEnchantingSilkTouch extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityEnchantingSilktouch.java // public class RuneEntityEnchantingSilktouch extends RuneEntity { // public RuneEntityEnchantingSilktouch(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, // TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // if(negated || Utils.takeXP(player, 10)){ // //find the bow stack // ItemStack toEnchant=ItemStack.EMPTY; // if(sacrifice!=null){ // for(ItemStack i:sacrifice){ // if(i.getItem()==Items.DIAMOND_PICKAXE || i.getItem()==Items.DIAMOND_SHOVEL){ // toEnchant=i; // } // } // } // if(toEnchant.isEmpty() && negated)toEnchant=new ItemStack(Items.DIAMOND_PICKAXE); // toEnchant.addEnchantment(Enchantments.SILK_TOUCH, Enchantments.SILK_TOUCH.getMaxLevel()); // toEnchant.setItemDamage(0); // Utils.spawnItemCentered(world, getPos(), toEnchant); // this.onPatternBroken(); // }else{ // this.onPatternBrokenByPlayer(player); // } // } // } // @Override // public void update() { // //not much until FX // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneEnchantingSilkTouch.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import net.minecraftforge.oredict.OreDictionary; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityEnchantingSilktouch; package xilef11.mc.runesofwizardry_classics.runes; public class RuneEnchantingSilkTouch extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runeenchantingsilktouch.json");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneEnchantingSilkTouch.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityEnchantingSilktouch.java // public class RuneEntityEnchantingSilktouch extends RuneEntity { // public RuneEntityEnchantingSilktouch(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, // TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // if(negated || Utils.takeXP(player, 10)){ // //find the bow stack // ItemStack toEnchant=ItemStack.EMPTY; // if(sacrifice!=null){ // for(ItemStack i:sacrifice){ // if(i.getItem()==Items.DIAMOND_PICKAXE || i.getItem()==Items.DIAMOND_SHOVEL){ // toEnchant=i; // } // } // } // if(toEnchant.isEmpty() && negated)toEnchant=new ItemStack(Items.DIAMOND_PICKAXE); // toEnchant.addEnchantment(Enchantments.SILK_TOUCH, Enchantments.SILK_TOUCH.getMaxLevel()); // toEnchant.setItemDamage(0); // Utils.spawnItemCentered(world, getPos(), toEnchant); // this.onPatternBroken(); // }else{ // this.onPatternBrokenByPlayer(player); // } // } // } // @Override // public void update() { // //not much until FX // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import net.minecraftforge.oredict.OreDictionary; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityEnchantingSilktouch;
@Override public String getID() { return "runeEnchantingSilkTouch"; } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,1,0); } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Blocks.GOLD_BLOCK),new ItemStack(Items.DIAMOND_PICKAXE,1,OreDictionary.WILDCARD_VALUE)}, {new ItemStack(Blocks.GOLD_BLOCK),new ItemStack(Items.DIAMOND_SHOVEL,1,OreDictionary.WILDCARD_VALUE)} //take 10 XP }; } /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.runes.ClassicRune#hasExtraSacrifice() */ @Override protected boolean hasExtraSacrifice() { return true; } @Override public String getName() { return Refs.Lang.RUNE+".enchantingsilktouch"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityEnchantingSilktouch.java // public class RuneEntityEnchantingSilktouch extends RuneEntity { // public RuneEntityEnchantingSilktouch(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, // TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // if(negated || Utils.takeXP(player, 10)){ // //find the bow stack // ItemStack toEnchant=ItemStack.EMPTY; // if(sacrifice!=null){ // for(ItemStack i:sacrifice){ // if(i.getItem()==Items.DIAMOND_PICKAXE || i.getItem()==Items.DIAMOND_SHOVEL){ // toEnchant=i; // } // } // } // if(toEnchant.isEmpty() && negated)toEnchant=new ItemStack(Items.DIAMOND_PICKAXE); // toEnchant.addEnchantment(Enchantments.SILK_TOUCH, Enchantments.SILK_TOUCH.getMaxLevel()); // toEnchant.setItemDamage(0); // Utils.spawnItemCentered(world, getPos(), toEnchant); // this.onPatternBroken(); // }else{ // this.onPatternBrokenByPlayer(player); // } // } // } // @Override // public void update() { // //not much until FX // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneEnchantingSilkTouch.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import net.minecraftforge.oredict.OreDictionary; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityEnchantingSilktouch; @Override public String getID() { return "runeEnchantingSilkTouch"; } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,1,0); } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Blocks.GOLD_BLOCK),new ItemStack(Items.DIAMOND_PICKAXE,1,OreDictionary.WILDCARD_VALUE)}, {new ItemStack(Blocks.GOLD_BLOCK),new ItemStack(Items.DIAMOND_SHOVEL,1,OreDictionary.WILDCARD_VALUE)} //take 10 XP }; } /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.runes.ClassicRune#hasExtraSacrifice() */ @Override protected boolean hasExtraSacrifice() { return true; } @Override public String getName() { return Refs.Lang.RUNE+".enchantingsilktouch"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
return new RuneEntityEnchantingSilktouch(actualPattern, front, dusts, entity, this);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityBarrier.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.util.Iterator; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustPlaced; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.utils.Utils;
package xilef11.mc.runesofwizardry_classics.runes.entity; /*Behaviour: * Lifts a 5x6 (hxv) wall *on* the rune */ public class RuneEntityBarrier extends RuneEntity { private static final int TICKS_PER_BLOCK=15; private static final int DEPTH=6; private static final int RAD=2;//length of the wall on each side of the rune public RuneEntityBarrier(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override public void onRuneActivatedbyPlayer(EntityPlayer player, ItemStack[] sacrifice, boolean negated) { World world = player.world; if(!world.isRemote){
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityBarrier.java import java.util.Iterator; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustPlaced; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.utils.Utils; package xilef11.mc.runesofwizardry_classics.runes.entity; /*Behaviour: * Lifts a 5x6 (hxv) wall *on* the rune */ public class RuneEntityBarrier extends RuneEntity { private static final int TICKS_PER_BLOCK=15; private static final int DEPTH=6; private static final int RAD=2;//length of the wall on each side of the rune public RuneEntityBarrier(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override public void onRuneActivatedbyPlayer(EntityPlayer player, ItemStack[] sacrifice, boolean negated) { World world = player.world; if(!world.isRemote){
if(!Utils.takeXP(player, 3)){
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityEnchantingFortune.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Enchantments; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.utils.Utils;
package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntityEnchantingFortune extends RuneEntity { public RuneEntityEnchantingFortune(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override public void onRuneActivatedbyPlayer(EntityPlayer player, ItemStack[] sacrifice, boolean negated) { World world = player.world; if(!world.isRemote){
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityEnchantingFortune.java import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Enchantments; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.utils.Utils; package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntityEnchantingFortune extends RuneEntity { public RuneEntityEnchantingFortune(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override public void onRuneActivatedbyPlayer(EntityPlayer player, ItemStack[] sacrifice, boolean negated) { World world = player.world; if(!world.isRemote){
if(negated || Utils.takeXP(player, 15)){
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneCompression.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityCompression.java // public class RuneEntityCompression extends RuneEntity { // public RuneEntityCompression(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, // TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // int numCoal=0; // for(ItemStack i:sacrifice){ // if(i.getItem()==Items.COAL)numCoal+=i.getCount(); // } // if(negated && numCoal==0)numCoal=32; // int numDiamonds = numCoal/32; // while(numDiamonds>64){ // Utils.spawnItemCentered(world, getPos(), new ItemStack(Items.DIAMOND,64)); // numDiamonds-=64; // } // Utils.spawnItemCentered(world, getPos(), new ItemStack(Items.DIAMOND,numDiamonds)); // this.onPatternBroken(); // } // } // @Override // public void update() { // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityCompression;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneCompression extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityCompression.java // public class RuneEntityCompression extends RuneEntity { // public RuneEntityCompression(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, // TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // int numCoal=0; // for(ItemStack i:sacrifice){ // if(i.getItem()==Items.COAL)numCoal+=i.getCount(); // } // if(negated && numCoal==0)numCoal=32; // int numDiamonds = numCoal/32; // while(numDiamonds>64){ // Utils.spawnItemCentered(world, getPos(), new ItemStack(Items.DIAMOND,64)); // numDiamonds-=64; // } // Utils.spawnItemCentered(world, getPos(), new ItemStack(Items.DIAMOND,numDiamonds)); // this.onPatternBroken(); // } // } // @Override // public void update() { // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneCompression.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityCompression; package xilef11.mc.runesofwizardry_classics.runes; public class RuneCompression extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runecompression.json");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneCompression.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityCompression.java // public class RuneEntityCompression extends RuneEntity { // public RuneEntityCompression(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, // TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // int numCoal=0; // for(ItemStack i:sacrifice){ // if(i.getItem()==Items.COAL)numCoal+=i.getCount(); // } // if(negated && numCoal==0)numCoal=32; // int numDiamonds = numCoal/32; // while(numDiamonds>64){ // Utils.spawnItemCentered(world, getPos(), new ItemStack(Items.DIAMOND,64)); // numDiamonds-=64; // } // Utils.spawnItemCentered(world, getPos(), new ItemStack(Items.DIAMOND,numDiamonds)); // this.onPatternBroken(); // } // } // @Override // public void update() { // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityCompression;
return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runecompression.json"); } @Override public String getID() { return "runeCompression"; } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,1,0); } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Blocks.IRON_BLOCK),makeWildcardStack(new ItemStack(Items.COAL,32))} }; } /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.runes.ClassicRune#hasExtraSacrifice() */ @Override protected boolean hasExtraSacrifice() { return true; } @Override public String getName() { return Refs.Lang.RUNE+".compression"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityCompression.java // public class RuneEntityCompression extends RuneEntity { // public RuneEntityCompression(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, // TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // int numCoal=0; // for(ItemStack i:sacrifice){ // if(i.getItem()==Items.COAL)numCoal+=i.getCount(); // } // if(negated && numCoal==0)numCoal=32; // int numDiamonds = numCoal/32; // while(numDiamonds>64){ // Utils.spawnItemCentered(world, getPos(), new ItemStack(Items.DIAMOND,64)); // numDiamonds-=64; // } // Utils.spawnItemCentered(world, getPos(), new ItemStack(Items.DIAMOND,numDiamonds)); // this.onPatternBroken(); // } // } // @Override // public void update() { // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneCompression.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityCompression; return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runecompression.json"); } @Override public String getID() { return "runeCompression"; } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,1,0); } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Blocks.IRON_BLOCK),makeWildcardStack(new ItemStack(Items.COAL,32))} }; } /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.runes.ClassicRune#hasExtraSacrifice() */ @Override protected boolean hasExtraSacrifice() { return true; } @Override public String getName() { return Refs.Lang.RUNE+".compression"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
return new RuneEntityCompression(actualPattern, front, dusts, entity, this);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneDusk.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityDusk.java // public class RuneEntityDusk extends RuneEntity { // private boolean activatedAtNight=false; // public RuneEntityDusk(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // activatedAtNight=!world.isDaytime(); // if(activatedAtNight){ // entity.setupStar(0xFFFFFF,0xFFFFFF); // entity.setDrawStar(true); // } // } // //maybe setup FX // } // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote){ // if(world.isDaytime()){//always true client-side // if(entity.beamdata==null){ // entity.setupBeam(0x000000, BeamType.SPIRAL); // entity.setDrawBeam(true); // entity.setDrawStar(false); // IBlockState state = world.getBlockState(getPos()); // world.notifyBlockUpdate(getPos(), state, state, 3); // } // world.setWorldTime(world.getWorldTime()+25); // activatedAtNight=false;//we got to daytime // }else{//if we got to night time // if(!activatedAtNight)this.onPatternBroken(); // } // }else{ // if(world.getCelestialAngle(0)<0.248 || world.getCelestialAngle(0)>0.752)world.setWorldTime(world.getWorldTime()+25); // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void readFromNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // activatedAtNight=compound.getBoolean("nightActivation"); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void writeToNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // compound.setBoolean("nightActivation", activatedAtNight); // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityDusk;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneDusk extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityDusk.java // public class RuneEntityDusk extends RuneEntity { // private boolean activatedAtNight=false; // public RuneEntityDusk(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // activatedAtNight=!world.isDaytime(); // if(activatedAtNight){ // entity.setupStar(0xFFFFFF,0xFFFFFF); // entity.setDrawStar(true); // } // } // //maybe setup FX // } // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote){ // if(world.isDaytime()){//always true client-side // if(entity.beamdata==null){ // entity.setupBeam(0x000000, BeamType.SPIRAL); // entity.setDrawBeam(true); // entity.setDrawStar(false); // IBlockState state = world.getBlockState(getPos()); // world.notifyBlockUpdate(getPos(), state, state, 3); // } // world.setWorldTime(world.getWorldTime()+25); // activatedAtNight=false;//we got to daytime // }else{//if we got to night time // if(!activatedAtNight)this.onPatternBroken(); // } // }else{ // if(world.getCelestialAngle(0)<0.248 || world.getCelestialAngle(0)>0.752)world.setWorldTime(world.getWorldTime()+25); // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void readFromNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // activatedAtNight=compound.getBoolean("nightActivation"); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void writeToNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // compound.setBoolean("nightActivation", activatedAtNight); // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneDusk.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityDusk; package xilef11.mc.runesofwizardry_classics.runes; public class RuneDusk extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runedusk.json");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneDusk.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityDusk.java // public class RuneEntityDusk extends RuneEntity { // private boolean activatedAtNight=false; // public RuneEntityDusk(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // activatedAtNight=!world.isDaytime(); // if(activatedAtNight){ // entity.setupStar(0xFFFFFF,0xFFFFFF); // entity.setDrawStar(true); // } // } // //maybe setup FX // } // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote){ // if(world.isDaytime()){//always true client-side // if(entity.beamdata==null){ // entity.setupBeam(0x000000, BeamType.SPIRAL); // entity.setDrawBeam(true); // entity.setDrawStar(false); // IBlockState state = world.getBlockState(getPos()); // world.notifyBlockUpdate(getPos(), state, state, 3); // } // world.setWorldTime(world.getWorldTime()+25); // activatedAtNight=false;//we got to daytime // }else{//if we got to night time // if(!activatedAtNight)this.onPatternBroken(); // } // }else{ // if(world.getCelestialAngle(0)<0.248 || world.getCelestialAngle(0)>0.752)world.setWorldTime(world.getWorldTime()+25); // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void readFromNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // activatedAtNight=compound.getBoolean("nightActivation"); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void writeToNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // compound.setBoolean("nightActivation", activatedAtNight); // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityDusk;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneDusk extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runedusk.json"); } @Override public String getID() { return "runeDusk"; } @Override protected Vec3i setupEntityPos() { return new Vec3i(0,0,0); } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Items.NETHER_WART,4),new ItemStack(Items.DYE,1,EnumDyeColor.BLUE.getMetadata())} }; } @Override public String getName() { return Refs.Lang.RUNE+".dusk"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityDusk.java // public class RuneEntityDusk extends RuneEntity { // private boolean activatedAtNight=false; // public RuneEntityDusk(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // activatedAtNight=!world.isDaytime(); // if(activatedAtNight){ // entity.setupStar(0xFFFFFF,0xFFFFFF); // entity.setDrawStar(true); // } // } // //maybe setup FX // } // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote){ // if(world.isDaytime()){//always true client-side // if(entity.beamdata==null){ // entity.setupBeam(0x000000, BeamType.SPIRAL); // entity.setDrawBeam(true); // entity.setDrawStar(false); // IBlockState state = world.getBlockState(getPos()); // world.notifyBlockUpdate(getPos(), state, state, 3); // } // world.setWorldTime(world.getWorldTime()+25); // activatedAtNight=false;//we got to daytime // }else{//if we got to night time // if(!activatedAtNight)this.onPatternBroken(); // } // }else{ // if(world.getCelestialAngle(0)<0.248 || world.getCelestialAngle(0)>0.752)world.setWorldTime(world.getWorldTime()+25); // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void readFromNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // activatedAtNight=compound.getBoolean("nightActivation"); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void writeToNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // compound.setBoolean("nightActivation", activatedAtNight); // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneDusk.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityDusk; package xilef11.mc.runesofwizardry_classics.runes; public class RuneDusk extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runedusk.json"); } @Override public String getID() { return "runeDusk"; } @Override protected Vec3i setupEntityPos() { return new Vec3i(0,0,0); } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Items.NETHER_WART,4),new ItemStack(Items.DYE,1,EnumDyeColor.BLUE.getMetadata())} }; } @Override public String getName() { return Refs.Lang.RUNE+".dusk"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
return new RuneEntityDusk(actualPattern, front, dusts, entity, this);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneRebirth.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityRebirth.java // public class RuneEntityRebirth extends RuneEntity { // private static final String NO_SPAWN_EGG = Refs.Lang.RUNE+".rebirth.noegg"; // /** // * @param actualPattern // * @param facing // * @param dusts // * @param entity // */ // public RuneEntityRebirth(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { // super(actualPattern, facing, dusts, entity,creator); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) // */ // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // //take xp if not negated // if(!negated){ // if(player.experienceLevel>=10){ // player.addExperienceLevel(-10); // }else{ // //kill the rune // this.onPatternBrokenByPlayer(player); // return; // } // } // double x,y,z,offset=0.25; // x=y=z=0; // int dir = face.getAxisDirection()==AxisDirection.NEGATIVE? -1:1; // switch(face.getAxis()){ // case X:x=offset*dir; // break; // case Y:y=offset*dir; // break; // case Z:z=offset*dir; // break; // } // entity.setupStar(0xFFFFFF, 0xFFFFFF,1,1,new Vec3d(x, y, z)); // entity.setDrawStar(true); // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#update() // */ // @Override // public void update() { // // not much here // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#handleEntityCollision(net.minecraft.world.World, net.minecraft.util.BlockPos, net.minecraft.block.state.IBlockState, net.minecraft.entity.Entity) // */ // @Override // public boolean handleEntityCollision(World worldIn, BlockPos pos,IBlockState state, Entity entityIn) { // if(!worldIn.isRemote){ // if((entityIn instanceof EntityLivingBase) && !(entityIn instanceof EntityPlayer)&&!(entityIn instanceof EntityArmorStand)){ // ResourceLocation entID = EntityList.getKey(entityIn); // // //check if a spawn egg exists TODO also config blacklist? // if(EntityList.ENTITY_EGGS.get(entID)!=null){ // ItemStack egg = new ItemStack(Items.SPAWN_EGG); // NBTTagCompound entityTag = new NBTTagCompound(); // entityTag.setString("id", entID.toString()); // egg.setTagInfo("EntityTag", entityTag); // Utils.spawnItemCentered(worldIn, pos, egg); // this.onPatternBroken();//kill the rune // entityIn.setDead();//kill the entity // }else{ // worldIn.getClosestPlayer(pos.getX(),pos.getY(),pos.getZ(), 16, false).sendMessage(new TextComponentTranslation(NO_SPAWN_EGG)); // } // } // } // return true; // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityRebirth;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneRebirth extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityRebirth.java // public class RuneEntityRebirth extends RuneEntity { // private static final String NO_SPAWN_EGG = Refs.Lang.RUNE+".rebirth.noegg"; // /** // * @param actualPattern // * @param facing // * @param dusts // * @param entity // */ // public RuneEntityRebirth(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { // super(actualPattern, facing, dusts, entity,creator); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) // */ // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // //take xp if not negated // if(!negated){ // if(player.experienceLevel>=10){ // player.addExperienceLevel(-10); // }else{ // //kill the rune // this.onPatternBrokenByPlayer(player); // return; // } // } // double x,y,z,offset=0.25; // x=y=z=0; // int dir = face.getAxisDirection()==AxisDirection.NEGATIVE? -1:1; // switch(face.getAxis()){ // case X:x=offset*dir; // break; // case Y:y=offset*dir; // break; // case Z:z=offset*dir; // break; // } // entity.setupStar(0xFFFFFF, 0xFFFFFF,1,1,new Vec3d(x, y, z)); // entity.setDrawStar(true); // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#update() // */ // @Override // public void update() { // // not much here // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#handleEntityCollision(net.minecraft.world.World, net.minecraft.util.BlockPos, net.minecraft.block.state.IBlockState, net.minecraft.entity.Entity) // */ // @Override // public boolean handleEntityCollision(World worldIn, BlockPos pos,IBlockState state, Entity entityIn) { // if(!worldIn.isRemote){ // if((entityIn instanceof EntityLivingBase) && !(entityIn instanceof EntityPlayer)&&!(entityIn instanceof EntityArmorStand)){ // ResourceLocation entID = EntityList.getKey(entityIn); // // //check if a spawn egg exists TODO also config blacklist? // if(EntityList.ENTITY_EGGS.get(entID)!=null){ // ItemStack egg = new ItemStack(Items.SPAWN_EGG); // NBTTagCompound entityTag = new NBTTagCompound(); // entityTag.setString("id", entID.toString()); // egg.setTagInfo("EntityTag", entityTag); // Utils.spawnItemCentered(worldIn, pos, egg); // this.onPatternBroken();//kill the rune // entityIn.setDead();//kill the entity // }else{ // worldIn.getClosestPlayer(pos.getX(),pos.getY(),pos.getZ(), 16, false).sendMessage(new TextComponentTranslation(NO_SPAWN_EGG)); // } // } // } // return true; // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneRebirth.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityRebirth; package xilef11.mc.runesofwizardry_classics.runes; public class RuneRebirth extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runerebirth.json");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySpriteEarth.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.util.HashSet; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagIntArray; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils;
package xilef11.mc.runesofwizardry_classics.runes.entity; /* * Really hard to guess what this does from code, and it crashes on activation... * managed to test on an older version: * 8 blocks float around the player, and surround it when crouching * when floating, blocks have no collision */ public class RuneEntitySpriteEarth extends FueledRuneEntity { public RuneEntitySpriteEarth(ItemStack[][] actualPattern,EnumFacing facing, Set<BlockPos> dusts,TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override protected int initialTicks() {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySpriteEarth.java import java.util.HashSet; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagIntArray; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils; package xilef11.mc.runesofwizardry_classics.runes.entity; /* * Really hard to guess what this does from code, and it crashes on activation... * managed to test on an older version: * 8 blocks float around the player, and surround it when crouching * when floating, blocks have no collision */ public class RuneEntitySpriteEarth extends FueledRuneEntity { public RuneEntitySpriteEarth(ItemStack[][] actualPattern,EnumFacing facing, Set<BlockPos> dusts,TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override protected int initialTicks() {
return 3*Refs.TICKS_PER_DAY;
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySpriteEarth.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.util.HashSet; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagIntArray; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils;
package xilef11.mc.runesofwizardry_classics.runes.entity; /* * Really hard to guess what this does from code, and it crashes on activation... * managed to test on an older version: * 8 blocks float around the player, and surround it when crouching * when floating, blocks have no collision */ public class RuneEntitySpriteEarth extends FueledRuneEntity { public RuneEntitySpriteEarth(ItemStack[][] actualPattern,EnumFacing facing, Set<BlockPos> dusts,TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override protected int initialTicks() { return 3*Refs.TICKS_PER_DAY; } private String activatingPlayer; /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.runes.entity.FueledRuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) */ @Override public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { super.onRuneActivatedbyPlayer(player, sacrifice, negated); if(!player.world.isRemote){
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySpriteEarth.java import java.util.HashSet; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagIntArray; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils; package xilef11.mc.runesofwizardry_classics.runes.entity; /* * Really hard to guess what this does from code, and it crashes on activation... * managed to test on an older version: * 8 blocks float around the player, and surround it when crouching * when floating, blocks have no collision */ public class RuneEntitySpriteEarth extends FueledRuneEntity { public RuneEntitySpriteEarth(ItemStack[][] actualPattern,EnumFacing facing, Set<BlockPos> dusts,TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override protected int initialTicks() { return 3*Refs.TICKS_PER_DAY; } private String activatingPlayer; /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.runes.entity.FueledRuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) */ @Override public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { super.onRuneActivatedbyPlayer(player, sacrifice, negated); if(!player.world.isRemote){
if((negated||Utils.takeXP(player, 20))){
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/items/ItemSpiritPickaxe.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // }
import java.util.Random; import com.zpig333.runesofwizardry.RunesOfWizardry; import com.zpig333.runesofwizardry.util.RayTracer; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics;
package xilef11.mc.runesofwizardry_classics.items; public class ItemSpiritPickaxe extends ItemPickaxe { private static ItemSpiritPickaxe instance; private String name = "spirit_pickaxe"; protected ItemSpiritPickaxe(ToolMaterial material) { super(material);
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/items/ItemSpiritPickaxe.java import java.util.Random; import com.zpig333.runesofwizardry.RunesOfWizardry; import com.zpig333.runesofwizardry.util.RayTracer; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics; package xilef11.mc.runesofwizardry_classics.items; public class ItemSpiritPickaxe extends ItemPickaxe { private static ItemSpiritPickaxe instance; private String name = "spirit_pickaxe"; protected ItemSpiritPickaxe(ToolMaterial material) { super(material);
setRegistryName(new ResourceLocation(Refs.MODID,getName()));
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/items/ItemSpiritPickaxe.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // }
import java.util.Random; import com.zpig333.runesofwizardry.RunesOfWizardry; import com.zpig333.runesofwizardry.util.RayTracer; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics;
package xilef11.mc.runesofwizardry_classics.items; public class ItemSpiritPickaxe extends ItemPickaxe { private static ItemSpiritPickaxe instance; private String name = "spirit_pickaxe"; protected ItemSpiritPickaxe(ToolMaterial material) { super(material); setRegistryName(new ResourceLocation(Refs.MODID,getName())); this.setCreativeTab(RunesOfWizardry.wizardry_tab); setUnlocalizedName(Refs.MODID+"_"+getName()); this.setMaxDamage(250); this.efficiency=16F; } public String getName(){ return name; } public static ItemSpiritPickaxe instance(){ if(instance==null){ instance=new ItemSpiritPickaxe(ToolMaterial.IRON); //model
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/items/ItemSpiritPickaxe.java import java.util.Random; import com.zpig333.runesofwizardry.RunesOfWizardry; import com.zpig333.runesofwizardry.util.RayTracer; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics; package xilef11.mc.runesofwizardry_classics.items; public class ItemSpiritPickaxe extends ItemPickaxe { private static ItemSpiritPickaxe instance; private String name = "spirit_pickaxe"; protected ItemSpiritPickaxe(ToolMaterial material) { super(material); setRegistryName(new ResourceLocation(Refs.MODID,getName())); this.setCreativeTab(RunesOfWizardry.wizardry_tab); setUnlocalizedName(Refs.MODID+"_"+getName()); this.setMaxDamage(250); this.efficiency=16F; } public String getName(){ return name; } public static ItemSpiritPickaxe instance(){ if(instance==null){ instance=new ItemSpiritPickaxe(ToolMaterial.IRON); //model
RunesofWizardry_Classics.proxy.RegisterItemModel(instance, 0, Refs.TEXTURE_PATH+instance.getName(), "inventory");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneBouncing.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityBouncing.java // public class RuneEntityBouncing extends RuneEntity { // public RuneEntityBouncing(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { // super(actualPattern, facing, dusts, entity,creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // } // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote){ // //remove fall damage for all entities within the action radius // int radius=6; // List<EntityLivingBase> negateFall = world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPos().add(-radius, -1, -radius), getPos().add(radius,radius,radius))); // for(EntityLivingBase ent:negateFall){ // ent.fallDistance=0; // } // } // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.WizardryRegistry; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustPlaced; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityBouncing;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneBouncing extends ClassicRune { public RuneBouncing(){ MinecraftForge.EVENT_BUS.register(this); } @Override public String getID() { return "runeBouncing"; } @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityBouncing.java // public class RuneEntityBouncing extends RuneEntity { // public RuneEntityBouncing(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { // super(actualPattern, facing, dusts, entity,creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // } // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote){ // //remove fall damage for all entities within the action radius // int radius=6; // List<EntityLivingBase> negateFall = world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPos().add(-radius, -1, -radius), getPos().add(radius,radius,radius))); // for(EntityLivingBase ent:negateFall){ // ent.fallDistance=0; // } // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneBouncing.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.WizardryRegistry; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustPlaced; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityBouncing; package xilef11.mc.runesofwizardry_classics.runes; public class RuneBouncing extends ClassicRune { public RuneBouncing(){ MinecraftForge.EVENT_BUS.register(this); } @Override public String getID() { return "runeBouncing"; } @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runebouncing.json");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneBouncing.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityBouncing.java // public class RuneEntityBouncing extends RuneEntity { // public RuneEntityBouncing(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { // super(actualPattern, facing, dusts, entity,creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // } // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote){ // //remove fall damage for all entities within the action radius // int radius=6; // List<EntityLivingBase> negateFall = world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPos().add(-radius, -1, -radius), getPos().add(radius,radius,radius))); // for(EntityLivingBase ent:negateFall){ // ent.fallDistance=0; // } // } // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.WizardryRegistry; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustPlaced; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityBouncing;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneBouncing extends ClassicRune { public RuneBouncing(){ MinecraftForge.EVENT_BUS.register(this); } @Override public String getID() { return "runeBouncing"; } @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runebouncing.json"); } @Override protected Vec3i setupEntityPos() { return new Vec3i(0,0,0); } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Items.SLIME_BALL,4)} }; } @Override public String getName() { return Refs.Lang.RUNE+".bouncing"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityBouncing.java // public class RuneEntityBouncing extends RuneEntity { // public RuneEntityBouncing(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { // super(actualPattern, facing, dusts, entity,creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // } // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote){ // //remove fall damage for all entities within the action radius // int radius=6; // List<EntityLivingBase> negateFall = world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPos().add(-radius, -1, -radius), getPos().add(radius,radius,radius))); // for(EntityLivingBase ent:negateFall){ // ent.fallDistance=0; // } // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneBouncing.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.WizardryRegistry; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustPlaced; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityBouncing; package xilef11.mc.runesofwizardry_classics.runes; public class RuneBouncing extends ClassicRune { public RuneBouncing(){ MinecraftForge.EVENT_BUS.register(this); } @Override public String getID() { return "runeBouncing"; } @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runebouncing.json"); } @Override protected Vec3i setupEntityPos() { return new Vec3i(0,0,0); } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Items.SLIME_BALL,4)} }; } @Override public String getName() { return Refs.Lang.RUNE+".bouncing"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
return new RuneEntityBouncing(actualPattern, front, dusts, entity,this);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityUnimplemented.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.RunesUtil; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentTranslation; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils;
/** * */ package xilef11.mc.runesofwizardry_classics.runes.entity; /** This RuneEntity serves as a placeholder so runes may be registered even if they're not implemented * @author Xilef11 * */ public class RuneEntityUnimplemented extends RuneEntity { private final String runeName;
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityUnimplemented.java import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.RunesUtil; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentTranslation; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils; /** * */ package xilef11.mc.runesofwizardry_classics.runes.entity; /** This RuneEntity serves as a placeholder so runes may be registered even if they're not implemented * @author Xilef11 * */ public class RuneEntityUnimplemented extends RuneEntity { private final String runeName;
public static final String message=Refs.Lang.RUNE+".unimplemented.message";
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityUnimplemented.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.RunesUtil; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentTranslation; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils;
/** * */ package xilef11.mc.runesofwizardry_classics.runes.entity; /** This RuneEntity serves as a placeholder so runes may be registered even if they're not implemented * @author Xilef11 * */ public class RuneEntityUnimplemented extends RuneEntity { private final String runeName; public static final String message=Refs.Lang.RUNE+".unimplemented.message"; /** * @param actualPattern * @param facing * @param dusts * @param entity */ public RuneEntityUnimplemented(ItemStack[][] actualPattern, EnumFacing facing,Set<BlockPos> dusts, TileEntityDustActive entity,IRune rune) { super(actualPattern, facing, dusts, entity,rune); this.runeName=rune.getName(); } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[]) */ @Override public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice,boolean negated) { player.sendMessage(new TextComponentTranslation(message, new TextComponentTranslation(runeName))); RunesUtil.deactivateRune(this); //return the sacrifice for(ItemStack i:sacrifice){
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityUnimplemented.java import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.RunesUtil; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentTranslation; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils; /** * */ package xilef11.mc.runesofwizardry_classics.runes.entity; /** This RuneEntity serves as a placeholder so runes may be registered even if they're not implemented * @author Xilef11 * */ public class RuneEntityUnimplemented extends RuneEntity { private final String runeName; public static final String message=Refs.Lang.RUNE+".unimplemented.message"; /** * @param actualPattern * @param facing * @param dusts * @param entity */ public RuneEntityUnimplemented(ItemStack[][] actualPattern, EnumFacing facing,Set<BlockPos> dusts, TileEntityDustActive entity,IRune rune) { super(actualPattern, facing, dusts, entity,rune); this.runeName=rune.getName(); } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[]) */ @Override public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice,boolean negated) { player.sendMessage(new TextComponentTranslation(message, new TextComponentTranslation(runeName))); RunesUtil.deactivateRune(this); //return the sacrifice for(ItemStack i:sacrifice){
Utils.spawnItemCentered(player.world, getPos(), i);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySarlacc.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // }
import java.util.List; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive.BeamType; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import xilef11.mc.runesofwizardry_classics.Refs;
package xilef11.mc.runesofwizardry_classics.runes.entity; /*Behaviour: * Lasts 1 day * Every mob kill adds 1/8 day * Every item kill (*stacksize) adds 1/2 sec * No matter where mobs are killed, (double) XP is dropped at the 4 "central" corners * Does not hurt players (summoning player only) * Kill zone is the smallest rectangle that contains the whole rune * - center + 4 on the long side (9 blocks) * - center + 3 on the short side (7 blocks) * don't forget the +1 in SE direction * - Height is 2(3) blocks */ public class RuneEntitySarlacc extends RuneEntity { private BlockPos nwd,seu;//north-west-down south-east-up bounds for the damage private int ticksremaining=0; private String activator=""; public RuneEntitySarlacc(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); //calculate NW and SE positions if(facing==EnumFacing.NORTH || facing ==EnumFacing.SOUTH){ //short side is North-south axis nwd = getPos().north(3).west(4).up(); seu = getPos().south(4).east(5).up(3); }else{ //short side is E-W axis nwd = getPos().north(4).west(3).up(); seu = getPos().south(5).east(4).up(3); } } @Override public void onRuneActivatedbyPlayer(EntityPlayer player, ItemStack[] sacrifice, boolean negated) { //not much if(!player.world.isRemote){
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySarlacc.java import java.util.List; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive.BeamType; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import xilef11.mc.runesofwizardry_classics.Refs; package xilef11.mc.runesofwizardry_classics.runes.entity; /*Behaviour: * Lasts 1 day * Every mob kill adds 1/8 day * Every item kill (*stacksize) adds 1/2 sec * No matter where mobs are killed, (double) XP is dropped at the 4 "central" corners * Does not hurt players (summoning player only) * Kill zone is the smallest rectangle that contains the whole rune * - center + 4 on the long side (9 blocks) * - center + 3 on the short side (7 blocks) * don't forget the +1 in SE direction * - Height is 2(3) blocks */ public class RuneEntitySarlacc extends RuneEntity { private BlockPos nwd,seu;//north-west-down south-east-up bounds for the damage private int ticksremaining=0; private String activator=""; public RuneEntitySarlacc(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); //calculate NW and SE positions if(facing==EnumFacing.NORTH || facing ==EnumFacing.SOUTH){ //short side is North-south axis nwd = getPos().north(3).west(4).up(); seu = getPos().south(4).east(5).up(3); }else{ //short side is E-W axis nwd = getPos().north(4).west(3).up(); seu = getPos().south(5).east(4).up(3); } } @Override public void onRuneActivatedbyPlayer(EntityPlayer player, ItemStack[] sacrifice, boolean negated) { //not much if(!player.world.isRemote){
ticksremaining=Refs.TICKS_PER_DAY;
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/managers/VoidStorageCapability.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // }
import java.util.Collection; import java.util.LinkedList; import java.util.List; import java.util.concurrent.Callable; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability.IStorage; import net.minecraftforge.common.capabilities.CapabilityInject; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.capabilities.ICapabilitySerializable; import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics;
package xilef11.mc.runesofwizardry_classics.managers; public class VoidStorageCapability{ @CapabilityInject(IVoidStorageCapability.class) public static Capability<IVoidStorageCapability> VOID_STORAGE_CAPABILITY=null;
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/managers/VoidStorageCapability.java import java.util.Collection; import java.util.LinkedList; import java.util.List; import java.util.concurrent.Callable; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability.IStorage; import net.minecraftforge.common.capabilities.CapabilityInject; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.capabilities.ICapabilitySerializable; import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics; package xilef11.mc.runesofwizardry_classics.managers; public class VoidStorageCapability{ @CapabilityInject(IVoidStorageCapability.class) public static Capability<IVoidStorageCapability> VOID_STORAGE_CAPABILITY=null;
public static final ResourceLocation capabilityKey = new ResourceLocation(Refs.MODID,"voidstoragecapability");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/managers/VoidStorageCapability.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // }
import java.util.Collection; import java.util.LinkedList; import java.util.List; import java.util.concurrent.Callable; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability.IStorage; import net.minecraftforge.common.capabilities.CapabilityInject; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.capabilities.ICapabilitySerializable; import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics;
} } public static void register(){ CapabilityManager.INSTANCE.register(IVoidStorageCapability.class, new Storage(), new Factory()); MinecraftForge.EVENT_BUS.register(new VoidStorageCapability()); } private static class Storage implements IStorage<IVoidStorageCapability> { @Override public NBTBase writeNBT(Capability<IVoidStorageCapability> capability,IVoidStorageCapability instance, EnumFacing side) { NBTTagList stacks = new NBTTagList(); for(ItemStack i:instance.getVoidInventory()){ if(!i.isEmpty()){ NBTTagCompound comp = new NBTTagCompound(); i.writeToNBT(comp); stacks.appendTag(comp); } } return stacks; } @Override public void readNBT(Capability<IVoidStorageCapability> capability,IVoidStorageCapability instance, EnumFacing side, NBTBase nbt) { if(nbt instanceof NBTTagList){ NBTTagList list = (NBTTagList)nbt; for(int i=0;i<list.tagCount();i++){ NBTTagCompound comp = list.getCompoundTagAt(i); if(comp!=null){ instance.addStackToVoid(new ItemStack(comp)); } } }else{
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/managers/VoidStorageCapability.java import java.util.Collection; import java.util.LinkedList; import java.util.List; import java.util.concurrent.Callable; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability.IStorage; import net.minecraftforge.common.capabilities.CapabilityInject; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.capabilities.ICapabilitySerializable; import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics; } } public static void register(){ CapabilityManager.INSTANCE.register(IVoidStorageCapability.class, new Storage(), new Factory()); MinecraftForge.EVENT_BUS.register(new VoidStorageCapability()); } private static class Storage implements IStorage<IVoidStorageCapability> { @Override public NBTBase writeNBT(Capability<IVoidStorageCapability> capability,IVoidStorageCapability instance, EnumFacing side) { NBTTagList stacks = new NBTTagList(); for(ItemStack i:instance.getVoidInventory()){ if(!i.isEmpty()){ NBTTagCompound comp = new NBTTagCompound(); i.writeToNBT(comp); stacks.appendTag(comp); } } return stacks; } @Override public void readNBT(Capability<IVoidStorageCapability> capability,IVoidStorageCapability instance, EnumFacing side, NBTBase nbt) { if(nbt instanceof NBTTagList){ NBTTagList list = (NBTTagList)nbt; for(int i=0;i<list.tagCount();i++){ NBTTagCompound comp = list.getCompoundTagAt(i); if(comp!=null){ instance.addStackToVoid(new ItemStack(comp)); } } }else{
RunesofWizardry_Classics.log().error("VoidStorageCapability storage attempted to read from wrong NBT tag type");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/items/ItemSpiritSword.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // }
import java.util.Random; import com.google.common.collect.Multimap; import com.zpig333.runesofwizardry.RunesOfWizardry; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Enchantments; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics;
package xilef11.mc.runesofwizardry_classics.items; public class ItemSpiritSword extends ItemSword{ private String name = "spirit_sword"; private static ItemSpiritSword instance=null; private ItemSpiritSword(ToolMaterial material) { super(material);
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/items/ItemSpiritSword.java import java.util.Random; import com.google.common.collect.Multimap; import com.zpig333.runesofwizardry.RunesOfWizardry; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Enchantments; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics; package xilef11.mc.runesofwizardry_classics.items; public class ItemSpiritSword extends ItemSword{ private String name = "spirit_sword"; private static ItemSpiritSword instance=null; private ItemSpiritSword(ToolMaterial material) { super(material);
setRegistryName(new ResourceLocation(Refs.MODID,getName()));
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/items/ItemSpiritSword.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // }
import java.util.Random; import com.google.common.collect.Multimap; import com.zpig333.runesofwizardry.RunesOfWizardry; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Enchantments; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics;
package xilef11.mc.runesofwizardry_classics.items; public class ItemSpiritSword extends ItemSword{ private String name = "spirit_sword"; private static ItemSpiritSword instance=null; private ItemSpiritSword(ToolMaterial material) { super(material); setRegistryName(new ResourceLocation(Refs.MODID,getName())); this.setCreativeTab(RunesOfWizardry.wizardry_tab); setUnlocalizedName(Refs.MODID+"_"+getName()); this.setMaxDamage(131); } public String getName(){ return name; } private ItemSpiritSword(){ this(ToolMaterial.GOLD); } public static ItemSpiritSword instance(){ if(instance==null){ instance=new ItemSpiritSword();
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/items/ItemSpiritSword.java import java.util.Random; import com.google.common.collect.Multimap; import com.zpig333.runesofwizardry.RunesOfWizardry; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Enchantments; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics; package xilef11.mc.runesofwizardry_classics.items; public class ItemSpiritSword extends ItemSword{ private String name = "spirit_sword"; private static ItemSpiritSword instance=null; private ItemSpiritSword(ToolMaterial material) { super(material); setRegistryName(new ResourceLocation(Refs.MODID,getName())); this.setCreativeTab(RunesOfWizardry.wizardry_tab); setUnlocalizedName(Refs.MODID+"_"+getName()); this.setMaxDamage(131); } public String getName(){ return name; } private ItemSpiritSword(){ this(ToolMaterial.GOLD); } public static ItemSpiritSword instance(){ if(instance==null){ instance=new ItemSpiritSword();
RunesofWizardry_Classics.proxy.RegisterItemModel(instance, 0, Refs.TEXTURE_PATH+instance.getName(),"inventory");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/integration/guideapi/GuideBookAdditions.java // public class GuideBookAdditions { // /**Add a few things to the entries created automatically by the base mod **/ // public static void handlePost(){ // Book book = GuideAPI.getBooks().get(WizardryGuide.LOCATION); // //placeholder // CategoryAbstract dusts = BookHelper.getCategoryFromName(book, WizardryGuide.CAT_LOC+CategoryDusts.NAME); // EntryAbstract placeholders = BookHelper.getEntryFromName(dusts, CategoryDusts.ENTRY_KEY+"placeholders"); // placeholders.addPage(new PageItemStack(Refs.MODID+".guide.variabledust",new ItemStack(DustVariable.instance))); // // //spirit tools // CategoryAbstract runes = BookHelper.getCategoryFromName(book,WizardryGuide.CAT_LOC+CategoryRunes.NAME); // EntryAbstract spiritTools = BookHelper.getEntryFromName(runes,Refs.Lang.RUNE+".spirittools"); // if(spiritTools!=null){ // spiritTools.addPage(new PageItemStack(Refs.MODID+".guide.spiritpick", ItemSpiritPickaxe.instance())); // spiritTools.addPage(new PageItemStack(Refs.MODID+".guide.spiritsword", ItemSpiritSword.instance())); // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/items/ClassicDusts.java // public class ClassicDusts extends IDust { // public static IDust instance; // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.IDust#getDustName() // */ // @Override // public String getDustName() { // return "classic"; // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.IDust#getInfusionItems(net.minecraft.item.ItemStack) // */ // @Override // public ItemStack[] getInfusionItems(ItemStack arg0) { // //custom crafting recipes // return null; // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.IDust#getPrimaryColor(net.minecraft.item.ItemStack) // */ // @Override // public int getPrimaryColor(ItemStack stack) { // //we can assume it is this item... // return EnumDustTypes.getByMeta(stack.getMetadata()).primaryColor; // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.IDust#getSecondaryColor(net.minecraft.item.ItemStack) // */ // @Override // public int getSecondaryColor(ItemStack stack) { // return EnumDustTypes.getByMeta(stack.getMetadata()).secondaryColor; // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.IDust#getPlacedColor(net.minecraft.item.ItemStack) // */ // @Override // public int getPlacedColor(ItemStack stack) { // return EnumDustTypes.getByMeta(stack.getMetadata()).floorColor; // } // private static int[] metaVals=null; // @Override // public int[] getMetaValues() { // if(metaVals==null){ // EnumDustTypes vals[] = EnumDustTypes.values(); // metaVals = new int[vals.length]; // for(int i=0;i<vals.length;i++){ // metaVals[i]=vals[i].meta(); // } // } // return metaVals; // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/items/DustVariable.java // public class DustVariable extends DustPlaceholder { // public static DustVariable instance; // /** // */ // public DustVariable() { // super("variable", 0xb92db1, true); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.IDust#dustsMatch(net.minecraft.item.ItemStack, net.minecraft.item.ItemStack) // */ // @Override // public boolean dustsMatch(ItemStack thisDust, ItemStack other) { // return other.getItem() == ClassicDusts.instance; // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/proxy/IProxy.java // public interface IProxy { // public void RegisterItemModel(Item item,int meta,String modelpath,String variant); // }
import org.apache.logging.log4j.Logger; import com.zpig333.runesofwizardry.api.DustRegistry; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import xilef11.mc.runesofwizardry_classics.integration.guideapi.GuideBookAdditions; import xilef11.mc.runesofwizardry_classics.items.ClassicDusts; import xilef11.mc.runesofwizardry_classics.items.DustVariable; import xilef11.mc.runesofwizardry_classics.proxy.IProxy;
package xilef11.mc.runesofwizardry_classics; //note: loading before a dependency causes a noclassdeffound outside of a dev environment //@Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry@[1.12-0.8.3,)",acceptedMinecraftVersions = "[1.2,1.13)") @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") public class RunesofWizardry_Classics { @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY)
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/integration/guideapi/GuideBookAdditions.java // public class GuideBookAdditions { // /**Add a few things to the entries created automatically by the base mod **/ // public static void handlePost(){ // Book book = GuideAPI.getBooks().get(WizardryGuide.LOCATION); // //placeholder // CategoryAbstract dusts = BookHelper.getCategoryFromName(book, WizardryGuide.CAT_LOC+CategoryDusts.NAME); // EntryAbstract placeholders = BookHelper.getEntryFromName(dusts, CategoryDusts.ENTRY_KEY+"placeholders"); // placeholders.addPage(new PageItemStack(Refs.MODID+".guide.variabledust",new ItemStack(DustVariable.instance))); // // //spirit tools // CategoryAbstract runes = BookHelper.getCategoryFromName(book,WizardryGuide.CAT_LOC+CategoryRunes.NAME); // EntryAbstract spiritTools = BookHelper.getEntryFromName(runes,Refs.Lang.RUNE+".spirittools"); // if(spiritTools!=null){ // spiritTools.addPage(new PageItemStack(Refs.MODID+".guide.spiritpick", ItemSpiritPickaxe.instance())); // spiritTools.addPage(new PageItemStack(Refs.MODID+".guide.spiritsword", ItemSpiritSword.instance())); // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/items/ClassicDusts.java // public class ClassicDusts extends IDust { // public static IDust instance; // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.IDust#getDustName() // */ // @Override // public String getDustName() { // return "classic"; // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.IDust#getInfusionItems(net.minecraft.item.ItemStack) // */ // @Override // public ItemStack[] getInfusionItems(ItemStack arg0) { // //custom crafting recipes // return null; // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.IDust#getPrimaryColor(net.minecraft.item.ItemStack) // */ // @Override // public int getPrimaryColor(ItemStack stack) { // //we can assume it is this item... // return EnumDustTypes.getByMeta(stack.getMetadata()).primaryColor; // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.IDust#getSecondaryColor(net.minecraft.item.ItemStack) // */ // @Override // public int getSecondaryColor(ItemStack stack) { // return EnumDustTypes.getByMeta(stack.getMetadata()).secondaryColor; // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.IDust#getPlacedColor(net.minecraft.item.ItemStack) // */ // @Override // public int getPlacedColor(ItemStack stack) { // return EnumDustTypes.getByMeta(stack.getMetadata()).floorColor; // } // private static int[] metaVals=null; // @Override // public int[] getMetaValues() { // if(metaVals==null){ // EnumDustTypes vals[] = EnumDustTypes.values(); // metaVals = new int[vals.length]; // for(int i=0;i<vals.length;i++){ // metaVals[i]=vals[i].meta(); // } // } // return metaVals; // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/items/DustVariable.java // public class DustVariable extends DustPlaceholder { // public static DustVariable instance; // /** // */ // public DustVariable() { // super("variable", 0xb92db1, true); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.IDust#dustsMatch(net.minecraft.item.ItemStack, net.minecraft.item.ItemStack) // */ // @Override // public boolean dustsMatch(ItemStack thisDust, ItemStack other) { // return other.getItem() == ClassicDusts.instance; // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/proxy/IProxy.java // public interface IProxy { // public void RegisterItemModel(Item item,int meta,String modelpath,String variant); // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java import org.apache.logging.log4j.Logger; import com.zpig333.runesofwizardry.api.DustRegistry; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import xilef11.mc.runesofwizardry_classics.integration.guideapi.GuideBookAdditions; import xilef11.mc.runesofwizardry_classics.items.ClassicDusts; import xilef11.mc.runesofwizardry_classics.items.DustVariable; import xilef11.mc.runesofwizardry_classics.proxy.IProxy; package xilef11.mc.runesofwizardry_classics; //note: loading before a dependency causes a noclassdeffound outside of a dev environment //@Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry@[1.12-0.8.3,)",acceptedMinecraftVersions = "[1.2,1.13)") @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") public class RunesofWizardry_Classics { @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY)
public static IProxy proxy;
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityTorch.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // }
import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive.BeamType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics;
/** * */ package xilef11.mc.runesofwizardry_classics.runes.entity; /** * @author Xilef11 * */ public class RuneEntityTorch extends RuneEntity { public RuneEntityTorch(ItemStack[][] actualPattern, EnumFacing facing,Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { super(actualPattern, facing, dusts, entity,creator); } private boolean beacon=false; private int beaconColor=0xFFFFFF; /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[]) */ @Override public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice,boolean negated) {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityTorch.java import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive.BeamType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics; /** * */ package xilef11.mc.runesofwizardry_classics.runes.entity; /** * @author Xilef11 * */ public class RuneEntityTorch extends RuneEntity { public RuneEntityTorch(ItemStack[][] actualPattern, EnumFacing facing,Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { super(actualPattern, facing, dusts, entity,creator); } private boolean beacon=false; private int beaconColor=0xFFFFFF; /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[]) */ @Override public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice,boolean negated) {
RunesofWizardry_Classics.log().debug("Activated torch rune with sacrifice: "+sacrifice);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityTorch.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // }
import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive.BeamType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics;
/** * */ package xilef11.mc.runesofwizardry_classics.runes.entity; /** * @author Xilef11 * */ public class RuneEntityTorch extends RuneEntity { public RuneEntityTorch(ItemStack[][] actualPattern, EnumFacing facing,Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { super(actualPattern, facing, dusts, entity,creator); } private boolean beacon=false; private int beaconColor=0xFFFFFF; /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[]) */ @Override public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice,boolean negated) { RunesofWizardry_Classics.log().debug("Activated torch rune with sacrifice: "+sacrifice); if(sacrifice!=null||negated){ this.beacon=true; //create beacon entity.setupBeam(0xFFFFFF, BeamType.BEACON); entity.beamdata.beamRadius=0.1; entity.beamdata.glowRadius=0.2; entity.setDrawBeam(true); }else{ entity.setupStar(0xFFFFFF, 0xFFFFFF,1,1,new Vec3d(0,-0.9,0)); entity.setDrawStar(true); } } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#update() */ @Override public void update() { World world = entity.getWorld(); if(beacon){
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityTorch.java import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive.BeamType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics; /** * */ package xilef11.mc.runesofwizardry_classics.runes.entity; /** * @author Xilef11 * */ public class RuneEntityTorch extends RuneEntity { public RuneEntityTorch(ItemStack[][] actualPattern, EnumFacing facing,Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { super(actualPattern, facing, dusts, entity,creator); } private boolean beacon=false; private int beaconColor=0xFFFFFF; /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[]) */ @Override public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice,boolean negated) { RunesofWizardry_Classics.log().debug("Activated torch rune with sacrifice: "+sacrifice); if(sacrifice!=null||negated){ this.beacon=true; //create beacon entity.setupBeam(0xFFFFFF, BeamType.BEACON); entity.beamdata.beamRadius=0.1; entity.beamdata.glowRadius=0.2; entity.setDrawBeam(true); }else{ entity.setupStar(0xFFFFFF, 0xFFFFFF,1,1,new Vec3d(0,-0.9,0)); entity.setDrawStar(true); } } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#update() */ @Override public void update() { World world = entity.getWorld(); if(beacon){
if(!world.isRemote && entity.ticksExisted()%Refs.TPS==0){
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityFire.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // }
import java.util.List; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.core.rune.RunesUtil; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.util.EnumFacing; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import xilef11.mc.runesofwizardry_classics.Refs;
package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntityFire extends FueledRuneEntity { private static final int TICK_RATE=3; public RuneEntityFire(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override protected int initialTicks() {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityFire.java import java.util.List; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.core.rune.RunesUtil; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.util.EnumFacing; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import xilef11.mc.runesofwizardry_classics.Refs; package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntityFire extends FueledRuneEntity { private static final int TICK_RATE=3; public RuneEntityFire(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override protected int initialTicks() {
return Refs.TICKS_PER_DAY/4;
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityMusic.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.util.Collection; import java.util.Iterator; import java.util.Map; import java.util.Random; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemRecord; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils;
/** * */ package xilef11.mc.runesofwizardry_classics.runes.entity; /** * @author Xilef11 * */ public class RuneEntityMusic extends RuneEntity { /** * @param actualPattern * @param facing * @param dusts * @param entity */ public RuneEntityMusic(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { super(actualPattern, facing, dusts, entity,creator); } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) */ @Override public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#update() */ @Override public void update() { World world = entity.getWorld();
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityMusic.java import java.util.Collection; import java.util.Iterator; import java.util.Map; import java.util.Random; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemRecord; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils; /** * */ package xilef11.mc.runesofwizardry_classics.runes.entity; /** * @author Xilef11 * */ public class RuneEntityMusic extends RuneEntity { /** * @param actualPattern * @param facing * @param dusts * @param entity */ public RuneEntityMusic(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { super(actualPattern, facing, dusts, entity,creator); } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) */ @Override public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#update() */ @Override public void update() { World world = entity.getWorld();
if(!world.isRemote && entity.ticksExisted()==Refs.TPS*5){
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityPowerDistribution.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // }
import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustPlaced; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagIntArray; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics;
package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntityPowerDistribution extends FueledRuneEntity { public RuneEntityPowerDistribution(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override protected int initialTicks() {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityPowerDistribution.java import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustPlaced; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagIntArray; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics; package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntityPowerDistribution extends FueledRuneEntity { public RuneEntityPowerDistribution(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override protected int initialTicks() {
return Refs.TPS;//not really used, but must be >0
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityPowerDistribution.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // }
import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustPlaced; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagIntArray; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics;
/**Adds a rune to be powered by this**/ public void register(FueledRuneEntity toPower){ poweredRunes.add(toPower); if(toPower.entity.stardata!=null)toPower.entity.stardata.scale*=1.04F; stableFuel = TICKRATE*poweredRunes.size()*STABLE_FUEL_CYCLES; entity.setDrawStar(true); IBlockState state = entity.getWorld().getBlockState(getPos()); entity.getWorld().notifyBlockUpdate(getPos(), state, state, 3); } /**removes a rune to be powered by this**/ public void unregister(FueledRuneEntity toPower){ poweredRunes.remove(toPower); if(toPower.entity.stardata!=null)toPower.entity.stardata.scale/=1.04F; stableFuel = TICKRATE*poweredRunes.size()*STABLE_FUEL_CYCLES; if(poweredRunes.isEmpty())entity.setDrawStar(false); IBlockState state = entity.getWorld().getBlockState(getPos()); entity.getWorld().notifyBlockUpdate(getPos(), state, state, 3); } private Set<BlockPos> toInit=null; private boolean initialised=false; private void init(){ if(initialised || toInit==null ||entity==null ||entity.getWorld()==null)return; for(BlockPos p:toInit){ TileEntity t = entity.getWorld().getTileEntity(p); if(t instanceof TileEntityDustPlaced){ TileEntityDustPlaced te = (TileEntityDustPlaced)t; RuneEntity rune = te.getRune(); if((rune instanceof FueledRuneEntity) && !(rune instanceof RuneEntityPowerDistribution)){ ((FueledRuneEntity)rune).registerTo(this);; }else{
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityPowerDistribution.java import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustPlaced; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagIntArray; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics; /**Adds a rune to be powered by this**/ public void register(FueledRuneEntity toPower){ poweredRunes.add(toPower); if(toPower.entity.stardata!=null)toPower.entity.stardata.scale*=1.04F; stableFuel = TICKRATE*poweredRunes.size()*STABLE_FUEL_CYCLES; entity.setDrawStar(true); IBlockState state = entity.getWorld().getBlockState(getPos()); entity.getWorld().notifyBlockUpdate(getPos(), state, state, 3); } /**removes a rune to be powered by this**/ public void unregister(FueledRuneEntity toPower){ poweredRunes.remove(toPower); if(toPower.entity.stardata!=null)toPower.entity.stardata.scale/=1.04F; stableFuel = TICKRATE*poweredRunes.size()*STABLE_FUEL_CYCLES; if(poweredRunes.isEmpty())entity.setDrawStar(false); IBlockState state = entity.getWorld().getBlockState(getPos()); entity.getWorld().notifyBlockUpdate(getPos(), state, state, 3); } private Set<BlockPos> toInit=null; private boolean initialised=false; private void init(){ if(initialised || toInit==null ||entity==null ||entity.getWorld()==null)return; for(BlockPos p:toInit){ TileEntity t = entity.getWorld().getTileEntity(p); if(t instanceof TileEntityDustPlaced){ TileEntityDustPlaced te = (TileEntityDustPlaced)t; RuneEntity rune = te.getRune(); if((rune instanceof FueledRuneEntity) && !(rune instanceof RuneEntityPowerDistribution)){ ((FueledRuneEntity)rune).registerTo(this);; }else{
RunesofWizardry_Classics.log().error("rune at "+p+" was not appropriate for power distribution");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneSpawnerCollection.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySpawnerCollection.java // public class RuneEntitySpawnerCollection extends RuneEntity { // public RuneEntitySpawnerCollection(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { // super(actualPattern, facing, dusts, entity,creator); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[]) // */ // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice,boolean negated) { // World world = player.world; // if(!world.isRemote){ // //take xp if not negated // if(!negated){ // if(player.experienceLevel>=10){ // player.addExperienceLevel(-10); // }else{ // //kill the rune // this.onPatternBrokenByPlayer(player); // return; // } // } // entity.setupStar(0xFFFFFF, 0xFFFFFF,1.05F,1); // entity.setupBeam(0xFFFFFF, BeamType.SPIRAL); // entity.setDrawBeam(true); // entity.setDrawStar(true); // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#update() // */ // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote && entity.ticksExisted()==Refs.TPS*5){ // BlockPos spawnerPos = getPos().offset(face); // IBlockState spawnState = world.getBlockState(spawnerPos); // if(!(spawnState.getBlock()==Blocks.MOB_SPAWNER)){ // this.onPatternBroken();//break the pattern // }else{ // world.setBlockToAir(spawnerPos); // Utils.spawnItemCentered(world, spawnerPos, new ItemStack(Blocks.MOB_SPAWNER)); // world.playSound(null,getPos().getX(), getPos().getY(), getPos().getZ(), SoundEvents.ENTITY_CHICKEN_EGG, SoundCategory.BLOCKS, 0.5F, 0.8F + (world.rand.nextFloat() - world.rand.nextFloat())); // } // this.onPatternBroken(); // } // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntitySpawnerCollection;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneSpawnerCollection extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySpawnerCollection.java // public class RuneEntitySpawnerCollection extends RuneEntity { // public RuneEntitySpawnerCollection(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { // super(actualPattern, facing, dusts, entity,creator); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[]) // */ // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice,boolean negated) { // World world = player.world; // if(!world.isRemote){ // //take xp if not negated // if(!negated){ // if(player.experienceLevel>=10){ // player.addExperienceLevel(-10); // }else{ // //kill the rune // this.onPatternBrokenByPlayer(player); // return; // } // } // entity.setupStar(0xFFFFFF, 0xFFFFFF,1.05F,1); // entity.setupBeam(0xFFFFFF, BeamType.SPIRAL); // entity.setDrawBeam(true); // entity.setDrawStar(true); // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#update() // */ // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote && entity.ticksExisted()==Refs.TPS*5){ // BlockPos spawnerPos = getPos().offset(face); // IBlockState spawnState = world.getBlockState(spawnerPos); // if(!(spawnState.getBlock()==Blocks.MOB_SPAWNER)){ // this.onPatternBroken();//break the pattern // }else{ // world.setBlockToAir(spawnerPos); // Utils.spawnItemCentered(world, spawnerPos, new ItemStack(Blocks.MOB_SPAWNER)); // world.playSound(null,getPos().getX(), getPos().getY(), getPos().getZ(), SoundEvents.ENTITY_CHICKEN_EGG, SoundCategory.BLOCKS, 0.5F, 0.8F + (world.rand.nextFloat() - world.rand.nextFloat())); // } // this.onPatternBroken(); // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneSpawnerCollection.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntitySpawnerCollection; package xilef11.mc.runesofwizardry_classics.runes; public class RuneSpawnerCollection extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runespawnercollection.json");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneSpawnerCollection.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySpawnerCollection.java // public class RuneEntitySpawnerCollection extends RuneEntity { // public RuneEntitySpawnerCollection(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { // super(actualPattern, facing, dusts, entity,creator); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[]) // */ // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice,boolean negated) { // World world = player.world; // if(!world.isRemote){ // //take xp if not negated // if(!negated){ // if(player.experienceLevel>=10){ // player.addExperienceLevel(-10); // }else{ // //kill the rune // this.onPatternBrokenByPlayer(player); // return; // } // } // entity.setupStar(0xFFFFFF, 0xFFFFFF,1.05F,1); // entity.setupBeam(0xFFFFFF, BeamType.SPIRAL); // entity.setDrawBeam(true); // entity.setDrawStar(true); // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#update() // */ // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote && entity.ticksExisted()==Refs.TPS*5){ // BlockPos spawnerPos = getPos().offset(face); // IBlockState spawnState = world.getBlockState(spawnerPos); // if(!(spawnState.getBlock()==Blocks.MOB_SPAWNER)){ // this.onPatternBroken();//break the pattern // }else{ // world.setBlockToAir(spawnerPos); // Utils.spawnItemCentered(world, spawnerPos, new ItemStack(Blocks.MOB_SPAWNER)); // world.playSound(null,getPos().getX(), getPos().getY(), getPos().getZ(), SoundEvents.ENTITY_CHICKEN_EGG, SoundCategory.BLOCKS, 0.5F, 0.8F + (world.rand.nextFloat() - world.rand.nextFloat())); // } // this.onPatternBroken(); // } // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntitySpawnerCollection;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneSpawnerCollection extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runespawnercollection.json"); } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,2,0);//just below the spawner } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Items.GOLD_INGOT,6)}//SAC take 10 XP }; } /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.runes.ClassicRune#hasExtraSacrifice() */ @Override protected boolean hasExtraSacrifice() { return true; } @Override public String getName() { return Refs.Lang.RUNE+".spawnercollection"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySpawnerCollection.java // public class RuneEntitySpawnerCollection extends RuneEntity { // public RuneEntitySpawnerCollection(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { // super(actualPattern, facing, dusts, entity,creator); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[]) // */ // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice,boolean negated) { // World world = player.world; // if(!world.isRemote){ // //take xp if not negated // if(!negated){ // if(player.experienceLevel>=10){ // player.addExperienceLevel(-10); // }else{ // //kill the rune // this.onPatternBrokenByPlayer(player); // return; // } // } // entity.setupStar(0xFFFFFF, 0xFFFFFF,1.05F,1); // entity.setupBeam(0xFFFFFF, BeamType.SPIRAL); // entity.setDrawBeam(true); // entity.setDrawStar(true); // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#update() // */ // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote && entity.ticksExisted()==Refs.TPS*5){ // BlockPos spawnerPos = getPos().offset(face); // IBlockState spawnState = world.getBlockState(spawnerPos); // if(!(spawnState.getBlock()==Blocks.MOB_SPAWNER)){ // this.onPatternBroken();//break the pattern // }else{ // world.setBlockToAir(spawnerPos); // Utils.spawnItemCentered(world, spawnerPos, new ItemStack(Blocks.MOB_SPAWNER)); // world.playSound(null,getPos().getX(), getPos().getY(), getPos().getZ(), SoundEvents.ENTITY_CHICKEN_EGG, SoundCategory.BLOCKS, 0.5F, 0.8F + (world.rand.nextFloat() - world.rand.nextFloat())); // } // this.onPatternBroken(); // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneSpawnerCollection.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntitySpawnerCollection; package xilef11.mc.runesofwizardry_classics.runes; public class RuneSpawnerCollection extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runespawnercollection.json"); } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,2,0);//just below the spawner } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Items.GOLD_INGOT,6)}//SAC take 10 XP }; } /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.runes.ClassicRune#hasExtraSacrifice() */ @Override protected boolean hasExtraSacrifice() { return true; } @Override public String getName() { return Refs.Lang.RUNE+".spawnercollection"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
return new RuneEntitySpawnerCollection(actualPattern, front, dusts, entity,this);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityEnchantingSilktouch.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Enchantments; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.utils.Utils;
package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntityEnchantingSilktouch extends RuneEntity { public RuneEntityEnchantingSilktouch(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override public void onRuneActivatedbyPlayer(EntityPlayer player, ItemStack[] sacrifice, boolean negated) { World world = player.world; if(!world.isRemote){
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityEnchantingSilktouch.java import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Enchantments; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.utils.Utils; package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntityEnchantingSilktouch extends RuneEntity { public RuneEntityEnchantingSilktouch(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override public void onRuneActivatedbyPlayer(EntityPlayer player, ItemStack[] sacrifice, boolean negated) { World world = player.world; if(!world.isRemote){
if(negated || Utils.takeXP(player, 10)){
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneSpawnerReassignment.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityUnimplemented.java // public class RuneEntityUnimplemented extends RuneEntity { // private final String runeName; // public static final String message=Refs.Lang.RUNE+".unimplemented.message"; // /** // * @param actualPattern // * @param facing // * @param dusts // * @param entity // */ // public RuneEntityUnimplemented(ItemStack[][] actualPattern, EnumFacing facing,Set<BlockPos> dusts, TileEntityDustActive entity,IRune rune) { // super(actualPattern, facing, dusts, entity,rune); // this.runeName=rune.getName(); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[]) // */ // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice,boolean negated) { // player.sendMessage(new TextComponentTranslation(message, new TextComponentTranslation(runeName))); // RunesUtil.deactivateRune(this); // //return the sacrifice // for(ItemStack i:sacrifice){ // Utils.spawnItemCentered(player.world, getPos(), i); // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#update() // */ // @Override // public void update() { // //NOP // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityUnimplemented;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneSpawnerReassignment extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityUnimplemented.java // public class RuneEntityUnimplemented extends RuneEntity { // private final String runeName; // public static final String message=Refs.Lang.RUNE+".unimplemented.message"; // /** // * @param actualPattern // * @param facing // * @param dusts // * @param entity // */ // public RuneEntityUnimplemented(ItemStack[][] actualPattern, EnumFacing facing,Set<BlockPos> dusts, TileEntityDustActive entity,IRune rune) { // super(actualPattern, facing, dusts, entity,rune); // this.runeName=rune.getName(); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[]) // */ // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice,boolean negated) { // player.sendMessage(new TextComponentTranslation(message, new TextComponentTranslation(runeName))); // RunesUtil.deactivateRune(this); // //return the sacrifice // for(ItemStack i:sacrifice){ // Utils.spawnItemCentered(player.world, getPos(), i); // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#update() // */ // @Override // public void update() { // //NOP // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneSpawnerReassignment.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityUnimplemented; package xilef11.mc.runesofwizardry_classics.runes; public class RuneSpawnerReassignment extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runespawnerreassignment.json");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneSpawnerReassignment.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityUnimplemented.java // public class RuneEntityUnimplemented extends RuneEntity { // private final String runeName; // public static final String message=Refs.Lang.RUNE+".unimplemented.message"; // /** // * @param actualPattern // * @param facing // * @param dusts // * @param entity // */ // public RuneEntityUnimplemented(ItemStack[][] actualPattern, EnumFacing facing,Set<BlockPos> dusts, TileEntityDustActive entity,IRune rune) { // super(actualPattern, facing, dusts, entity,rune); // this.runeName=rune.getName(); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[]) // */ // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice,boolean negated) { // player.sendMessage(new TextComponentTranslation(message, new TextComponentTranslation(runeName))); // RunesUtil.deactivateRune(this); // //return the sacrifice // for(ItemStack i:sacrifice){ // Utils.spawnItemCentered(player.world, getPos(), i); // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#update() // */ // @Override // public void update() { // //NOP // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityUnimplemented;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneSpawnerReassignment extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runespawnerreassignment.json"); } @Override public String getID() { return "runeSpawnerReassignment"; } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,2,0);//below the spawner } @Override protected ItemStack[][] setupSacrifice() { return null; //No need for this rune, spawners can be set by using a spawn egg on them directly. // return new ItemStack[][]{ // {new ItemStack(Items.SPAWN_EGG),new ItemStack(Items.ender_pearl,2)}//take 10 xp (might have to do something to ignore egg NBT) // }; } /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.runes.ClassicRune#hasExtraSacrifice() */ @Override protected boolean hasExtraSacrifice() { return true; } @Override public String getName() { return Refs.Lang.RUNE+".spawnerreassignment"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityUnimplemented.java // public class RuneEntityUnimplemented extends RuneEntity { // private final String runeName; // public static final String message=Refs.Lang.RUNE+".unimplemented.message"; // /** // * @param actualPattern // * @param facing // * @param dusts // * @param entity // */ // public RuneEntityUnimplemented(ItemStack[][] actualPattern, EnumFacing facing,Set<BlockPos> dusts, TileEntityDustActive entity,IRune rune) { // super(actualPattern, facing, dusts, entity,rune); // this.runeName=rune.getName(); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[]) // */ // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice,boolean negated) { // player.sendMessage(new TextComponentTranslation(message, new TextComponentTranslation(runeName))); // RunesUtil.deactivateRune(this); // //return the sacrifice // for(ItemStack i:sacrifice){ // Utils.spawnItemCentered(player.world, getPos(), i); // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#update() // */ // @Override // public void update() { // //NOP // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneSpawnerReassignment.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityUnimplemented; package xilef11.mc.runesofwizardry_classics.runes; public class RuneSpawnerReassignment extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runespawnerreassignment.json"); } @Override public String getID() { return "runeSpawnerReassignment"; } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,2,0);//below the spawner } @Override protected ItemStack[][] setupSacrifice() { return null; //No need for this rune, spawners can be set by using a spawn egg on them directly. // return new ItemStack[][]{ // {new ItemStack(Items.SPAWN_EGG),new ItemStack(Items.ender_pearl,2)}//take 10 xp (might have to do something to ignore egg NBT) // }; } /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.runes.ClassicRune#hasExtraSacrifice() */ @Override protected boolean hasExtraSacrifice() { return true; } @Override public String getName() { return Refs.Lang.RUNE+".spawnerreassignment"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
return new RuneEntityUnimplemented(actualPattern, front, dusts, entity, this);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/inscriptions/InscriptionLeap.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.io.IOException; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils;
package xilef11.mc.runesofwizardry_classics.inscriptions; public class InscriptionLeap extends ClassicInscription { public InscriptionLeap(){ this(1.15,10); } public InscriptionLeap(double power,int damage){ POWER=power; DAMAGE=damage; } @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/inscriptions/InscriptionLeap.java import java.io.IOException; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils; package xilef11.mc.runesofwizardry_classics.inscriptions; public class InscriptionLeap extends ClassicInscription { public InscriptionLeap(){ this(1.15,10); } public InscriptionLeap(double power,int damage){ POWER=power; DAMAGE=damage; } @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(new ResourceLocation(Refs.MODID,"patterns/inscriptions/inscriptionleap.json"));
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/inscriptions/InscriptionLeap.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.io.IOException; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils;
package xilef11.mc.runesofwizardry_classics.inscriptions; public class InscriptionLeap extends ClassicInscription { public InscriptionLeap(){ this(1.15,10); } public InscriptionLeap(double power,int damage){ POWER=power; DAMAGE=damage; } @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(new ResourceLocation(Refs.MODID,"patterns/inscriptions/inscriptionleap.json")); } @Override protected ItemStack[] setupChargeItems() { return new ItemStack[]{new ItemStack(Items.FEATHER,4),new ItemStack(Items.FIREWORKS)};//4 xp } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.Inscription#onInscriptionCharged(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) */ @Override public boolean onInscriptionCharged(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { if(!player.world.isRemote){ if(!negated){
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/inscriptions/InscriptionLeap.java import java.io.IOException; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils; package xilef11.mc.runesofwizardry_classics.inscriptions; public class InscriptionLeap extends ClassicInscription { public InscriptionLeap(){ this(1.15,10); } public InscriptionLeap(double power,int damage){ POWER=power; DAMAGE=damage; } @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(new ResourceLocation(Refs.MODID,"patterns/inscriptions/inscriptionleap.json")); } @Override protected ItemStack[] setupChargeItems() { return new ItemStack[]{new ItemStack(Items.FEATHER,4),new ItemStack(Items.FIREWORKS)};//4 xp } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.Inscription#onInscriptionCharged(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) */ @Override public boolean onInscriptionCharged(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { if(!player.world.isRemote){ if(!negated){
return Utils.takeXP(player, 5);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityWisdom.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.utils.Utils;
package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntityWisdom extends RuneEntity { private static final byte RCDelay = 5*20;//delay in ticks between r-click and taking xp private String user;//username of activating player private byte ticksSinceRC=RCDelay+1;//ticks since last right-clicked (always <= delay) private int xpAbsorbed=0; public RuneEntityWisdom(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override public void onRuneActivatedbyPlayer(EntityPlayer player, ItemStack[] sacrifice, boolean negated) { World world = player.world; if(!world.isRemote){
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityWisdom.java import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.utils.Utils; package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntityWisdom extends RuneEntity { private static final byte RCDelay = 5*20;//delay in ticks between r-click and taking xp private String user;//username of activating player private byte ticksSinceRC=RCDelay+1;//ticks since last right-clicked (always <= delay) private int xpAbsorbed=0; public RuneEntityWisdom(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override public void onRuneActivatedbyPlayer(EntityPlayer player, ItemStack[] sacrifice, boolean negated) { World world = player.world; if(!world.isRemote){
if(negated || Utils.takeXP(player, 6)){
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneTrapCage.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityTrapCage.java // public class RuneEntityTrapCage extends RuneEntity { // private String user=""; // public RuneEntityTrapCage(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // //nothing here // if(!player.world.isRemote)user=player.getName(); // } // private static final int RADIUS=3; // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote){ // if(entity.ticksExisted()==5*Refs.TPS)this.renderActive=false; // List<EntityLivingBase> ents = world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPos().add(-RADIUS,-1,-RADIUS), getPos().add(RADIUS,1,RADIUS))); // if(!ents.isEmpty()){ // boolean broken=false; // for(EntityLivingBase e:ents){ // if(e instanceof EntityPlayer){ // if(((EntityPlayer)e).getName().equals(user))continue; // } // if(!broken){ // this.onPatternBroken(); // broken=true; // } // BlockPos pos = e.getPosition(); // for(int x=-1;x<=1;x++){ // for(int z=-1;z<=1;z++){ // for(int y=-1;y<=1;y++){ // BlockPos p = pos.add(x, y, z); // Block b = world.getBlockState(p).getBlock(); // if((b.isReplaceable(world, p)||b==WizardryRegistry.dust_placed)&&!(x==0&&z==0)){ // world.setBlockState(p, Blocks.IRON_BARS.getDefaultState()); // } // } // } // } // } // } // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void readFromNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // user=compound.getString("username"); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void writeToNBT(NBTTagCompound compound) { // super.writeToNBT(compound); // compound.setString("username", user); // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityTrapCage;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneTrapCage extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityTrapCage.java // public class RuneEntityTrapCage extends RuneEntity { // private String user=""; // public RuneEntityTrapCage(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // //nothing here // if(!player.world.isRemote)user=player.getName(); // } // private static final int RADIUS=3; // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote){ // if(entity.ticksExisted()==5*Refs.TPS)this.renderActive=false; // List<EntityLivingBase> ents = world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPos().add(-RADIUS,-1,-RADIUS), getPos().add(RADIUS,1,RADIUS))); // if(!ents.isEmpty()){ // boolean broken=false; // for(EntityLivingBase e:ents){ // if(e instanceof EntityPlayer){ // if(((EntityPlayer)e).getName().equals(user))continue; // } // if(!broken){ // this.onPatternBroken(); // broken=true; // } // BlockPos pos = e.getPosition(); // for(int x=-1;x<=1;x++){ // for(int z=-1;z<=1;z++){ // for(int y=-1;y<=1;y++){ // BlockPos p = pos.add(x, y, z); // Block b = world.getBlockState(p).getBlock(); // if((b.isReplaceable(world, p)||b==WizardryRegistry.dust_placed)&&!(x==0&&z==0)){ // world.setBlockState(p, Blocks.IRON_BARS.getDefaultState()); // } // } // } // } // } // } // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void readFromNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // user=compound.getString("username"); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void writeToNBT(NBTTagCompound compound) { // super.writeToNBT(compound); // compound.setString("username", user); // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneTrapCage.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityTrapCage; package xilef11.mc.runesofwizardry_classics.runes; public class RuneTrapCage extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runeentrapment.json");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneTrapCage.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityTrapCage.java // public class RuneEntityTrapCage extends RuneEntity { // private String user=""; // public RuneEntityTrapCage(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // //nothing here // if(!player.world.isRemote)user=player.getName(); // } // private static final int RADIUS=3; // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote){ // if(entity.ticksExisted()==5*Refs.TPS)this.renderActive=false; // List<EntityLivingBase> ents = world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPos().add(-RADIUS,-1,-RADIUS), getPos().add(RADIUS,1,RADIUS))); // if(!ents.isEmpty()){ // boolean broken=false; // for(EntityLivingBase e:ents){ // if(e instanceof EntityPlayer){ // if(((EntityPlayer)e).getName().equals(user))continue; // } // if(!broken){ // this.onPatternBroken(); // broken=true; // } // BlockPos pos = e.getPosition(); // for(int x=-1;x<=1;x++){ // for(int z=-1;z<=1;z++){ // for(int y=-1;y<=1;y++){ // BlockPos p = pos.add(x, y, z); // Block b = world.getBlockState(p).getBlock(); // if((b.isReplaceable(world, p)||b==WizardryRegistry.dust_placed)&&!(x==0&&z==0)){ // world.setBlockState(p, Blocks.IRON_BARS.getDefaultState()); // } // } // } // } // } // } // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void readFromNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // user=compound.getString("username"); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void writeToNBT(NBTTagCompound compound) { // super.writeToNBT(compound); // compound.setString("username", user); // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityTrapCage;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneTrapCage extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runeentrapment.json"); } @Override public String getID() { return "runeEntrapment"; } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,1,0); } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Items.IRON_INGOT,6),new ItemStack(Items.REDSTONE,2)} }; } @Override public String getName() { return Refs.Lang.RUNE+".entrapment"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityTrapCage.java // public class RuneEntityTrapCage extends RuneEntity { // private String user=""; // public RuneEntityTrapCage(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // //nothing here // if(!player.world.isRemote)user=player.getName(); // } // private static final int RADIUS=3; // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote){ // if(entity.ticksExisted()==5*Refs.TPS)this.renderActive=false; // List<EntityLivingBase> ents = world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPos().add(-RADIUS,-1,-RADIUS), getPos().add(RADIUS,1,RADIUS))); // if(!ents.isEmpty()){ // boolean broken=false; // for(EntityLivingBase e:ents){ // if(e instanceof EntityPlayer){ // if(((EntityPlayer)e).getName().equals(user))continue; // } // if(!broken){ // this.onPatternBroken(); // broken=true; // } // BlockPos pos = e.getPosition(); // for(int x=-1;x<=1;x++){ // for(int z=-1;z<=1;z++){ // for(int y=-1;y<=1;y++){ // BlockPos p = pos.add(x, y, z); // Block b = world.getBlockState(p).getBlock(); // if((b.isReplaceable(world, p)||b==WizardryRegistry.dust_placed)&&!(x==0&&z==0)){ // world.setBlockState(p, Blocks.IRON_BARS.getDefaultState()); // } // } // } // } // } // } // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void readFromNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // user=compound.getString("username"); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void writeToNBT(NBTTagCompound compound) { // super.writeToNBT(compound); // compound.setString("username", user); // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneTrapCage.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityTrapCage; package xilef11.mc.runesofwizardry_classics.runes; public class RuneTrapCage extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runeentrapment.json"); } @Override public String getID() { return "runeEntrapment"; } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,1,0); } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Items.IRON_INGOT,6),new ItemStack(Items.REDSTONE,2)} }; } @Override public String getName() { return Refs.Lang.RUNE+".entrapment"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
return new RuneEntityTrapCage(actualPattern, front, dusts, entity, this);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneEnchantingFireBow.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityEnchantingFireBow.java // public class RuneEntityEnchantingFireBow extends RuneEntity { // public RuneEntityEnchantingFireBow(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, // TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // if(negated || Utils.takeXP(player, 5)){ // //find the bow stack // ItemStack bow=ItemStack.EMPTY; // if(sacrifice!=null){ // for(ItemStack i:sacrifice){ // if(i.getItem()==Items.BOW){ // bow=i; // } // } // } // if(bow.isEmpty() && negated)bow = new ItemStack(Items.BOW); // bow.addEnchantment(Enchantments.FLAME, Enchantments.FLAME.getMaxLevel()); // bow.setItemDamage(0); // Utils.spawnItemCentered(world, getPos(), bow); // this.onPatternBroken(); // }else{ // this.onPatternBrokenByPlayer(player); // } // } // } // @Override // public void update() { // // not much until we have FX // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import net.minecraftforge.oredict.OreDictionary; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityEnchantingFireBow;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneEnchantingFireBow extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityEnchantingFireBow.java // public class RuneEntityEnchantingFireBow extends RuneEntity { // public RuneEntityEnchantingFireBow(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, // TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // if(negated || Utils.takeXP(player, 5)){ // //find the bow stack // ItemStack bow=ItemStack.EMPTY; // if(sacrifice!=null){ // for(ItemStack i:sacrifice){ // if(i.getItem()==Items.BOW){ // bow=i; // } // } // } // if(bow.isEmpty() && negated)bow = new ItemStack(Items.BOW); // bow.addEnchantment(Enchantments.FLAME, Enchantments.FLAME.getMaxLevel()); // bow.setItemDamage(0); // Utils.spawnItemCentered(world, getPos(), bow); // this.onPatternBroken(); // }else{ // this.onPatternBrokenByPlayer(player); // } // } // } // @Override // public void update() { // // not much until we have FX // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneEnchantingFireBow.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import net.minecraftforge.oredict.OreDictionary; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityEnchantingFireBow; package xilef11.mc.runesofwizardry_classics.runes; public class RuneEnchantingFireBow extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runeenchantingfirebow.json");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneEnchantingFireBow.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityEnchantingFireBow.java // public class RuneEntityEnchantingFireBow extends RuneEntity { // public RuneEntityEnchantingFireBow(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, // TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // if(negated || Utils.takeXP(player, 5)){ // //find the bow stack // ItemStack bow=ItemStack.EMPTY; // if(sacrifice!=null){ // for(ItemStack i:sacrifice){ // if(i.getItem()==Items.BOW){ // bow=i; // } // } // } // if(bow.isEmpty() && negated)bow = new ItemStack(Items.BOW); // bow.addEnchantment(Enchantments.FLAME, Enchantments.FLAME.getMaxLevel()); // bow.setItemDamage(0); // Utils.spawnItemCentered(world, getPos(), bow); // this.onPatternBroken(); // }else{ // this.onPatternBrokenByPlayer(player); // } // } // } // @Override // public void update() { // // not much until we have FX // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import net.minecraftforge.oredict.OreDictionary; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityEnchantingFireBow;
} @Override public String getID() { return "runeEnchantingFireBow"; } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,1,0); } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ //SAC might want to do stuff to accept any bow {new ItemStack(Items.FIRE_CHARGE,9),new ItemStack(Items.BOW,1,OreDictionary.WILDCARD_VALUE),new ItemStack(Blocks.GOLD_BLOCK)}// take 5 XP }; } /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.runes.ClassicRune#hasExtraSacrifice() */ @Override protected boolean hasExtraSacrifice() { return true; } @Override public String getName() { return Refs.Lang.RUNE+".enchantingfirebow"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityEnchantingFireBow.java // public class RuneEntityEnchantingFireBow extends RuneEntity { // public RuneEntityEnchantingFireBow(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, // TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // if(negated || Utils.takeXP(player, 5)){ // //find the bow stack // ItemStack bow=ItemStack.EMPTY; // if(sacrifice!=null){ // for(ItemStack i:sacrifice){ // if(i.getItem()==Items.BOW){ // bow=i; // } // } // } // if(bow.isEmpty() && negated)bow = new ItemStack(Items.BOW); // bow.addEnchantment(Enchantments.FLAME, Enchantments.FLAME.getMaxLevel()); // bow.setItemDamage(0); // Utils.spawnItemCentered(world, getPos(), bow); // this.onPatternBroken(); // }else{ // this.onPatternBrokenByPlayer(player); // } // } // } // @Override // public void update() { // // not much until we have FX // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneEnchantingFireBow.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import net.minecraftforge.oredict.OreDictionary; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityEnchantingFireBow; } @Override public String getID() { return "runeEnchantingFireBow"; } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,1,0); } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ //SAC might want to do stuff to accept any bow {new ItemStack(Items.FIRE_CHARGE,9),new ItemStack(Items.BOW,1,OreDictionary.WILDCARD_VALUE),new ItemStack(Blocks.GOLD_BLOCK)}// take 5 XP }; } /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.runes.ClassicRune#hasExtraSacrifice() */ @Override protected boolean hasExtraSacrifice() { return true; } @Override public String getName() { return Refs.Lang.RUNE+".enchantingfirebow"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
return new RuneEntityEnchantingFireBow(actualPattern, front, dusts, entity, this);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySpawnerCollection.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive.BeamType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils;
/** * */ package xilef11.mc.runesofwizardry_classics.runes.entity; /** * @author Xilef11 * */ public class RuneEntitySpawnerCollection extends RuneEntity { public RuneEntitySpawnerCollection(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { super(actualPattern, facing, dusts, entity,creator); } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[]) */ @Override public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice,boolean negated) { World world = player.world; if(!world.isRemote){ //take xp if not negated if(!negated){ if(player.experienceLevel>=10){ player.addExperienceLevel(-10); }else{ //kill the rune this.onPatternBrokenByPlayer(player); return; } } entity.setupStar(0xFFFFFF, 0xFFFFFF,1.05F,1); entity.setupBeam(0xFFFFFF, BeamType.SPIRAL); entity.setDrawBeam(true); entity.setDrawStar(true); } } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#update() */ @Override public void update() { World world = entity.getWorld();
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySpawnerCollection.java import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive.BeamType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils; /** * */ package xilef11.mc.runesofwizardry_classics.runes.entity; /** * @author Xilef11 * */ public class RuneEntitySpawnerCollection extends RuneEntity { public RuneEntitySpawnerCollection(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity,IRune creator) { super(actualPattern, facing, dusts, entity,creator); } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[]) */ @Override public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice,boolean negated) { World world = player.world; if(!world.isRemote){ //take xp if not negated if(!negated){ if(player.experienceLevel>=10){ player.addExperienceLevel(-10); }else{ //kill the rune this.onPatternBrokenByPlayer(player); return; } } entity.setupStar(0xFFFFFF, 0xFFFFFF,1.05F,1); entity.setupBeam(0xFFFFFF, BeamType.SPIRAL); entity.setDrawBeam(true); entity.setDrawStar(true); } } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#update() */ @Override public void update() { World world = entity.getWorld();
if(!world.isRemote && entity.ticksExisted()==Refs.TPS*5){
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySpawnerCollection.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive.BeamType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils;
if(!world.isRemote){ //take xp if not negated if(!negated){ if(player.experienceLevel>=10){ player.addExperienceLevel(-10); }else{ //kill the rune this.onPatternBrokenByPlayer(player); return; } } entity.setupStar(0xFFFFFF, 0xFFFFFF,1.05F,1); entity.setupBeam(0xFFFFFF, BeamType.SPIRAL); entity.setDrawBeam(true); entity.setDrawStar(true); } } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#update() */ @Override public void update() { World world = entity.getWorld(); if(!world.isRemote && entity.ticksExisted()==Refs.TPS*5){ BlockPos spawnerPos = getPos().offset(face); IBlockState spawnState = world.getBlockState(spawnerPos); if(!(spawnState.getBlock()==Blocks.MOB_SPAWNER)){ this.onPatternBroken();//break the pattern }else{ world.setBlockToAir(spawnerPos);
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySpawnerCollection.java import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive.BeamType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils; if(!world.isRemote){ //take xp if not negated if(!negated){ if(player.experienceLevel>=10){ player.addExperienceLevel(-10); }else{ //kill the rune this.onPatternBrokenByPlayer(player); return; } } entity.setupStar(0xFFFFFF, 0xFFFFFF,1.05F,1); entity.setupBeam(0xFFFFFF, BeamType.SPIRAL); entity.setDrawBeam(true); entity.setDrawStar(true); } } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.RuneEntity#update() */ @Override public void update() { World world = entity.getWorld(); if(!world.isRemote && entity.ticksExisted()==Refs.TPS*5){ BlockPos spawnerPos = getPos().offset(face); IBlockState spawnState = world.getBlockState(spawnerPos); if(!(spawnState.getBlock()==Blocks.MOB_SPAWNER)){ this.onPatternBroken();//break the pattern }else{ world.setBlockToAir(spawnerPos);
Utils.spawnItemCentered(world, spawnerPos, new ItemStack(Blocks.MOB_SPAWNER));
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityEnchantingFireBow.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Enchantments; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.utils.Utils;
package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntityEnchantingFireBow extends RuneEntity { public RuneEntityEnchantingFireBow(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { World world = player.world; if(!world.isRemote){
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityEnchantingFireBow.java import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Enchantments; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.utils.Utils; package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntityEnchantingFireBow extends RuneEntity { public RuneEntityEnchantingFireBow(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { World world = player.world; if(!world.isRemote){
if(negated || Utils.takeXP(player, 5)){
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/inscriptions/InscriptionBounce.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // }
import java.io.IOException; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs;
package xilef11.mc.runesofwizardry_classics.inscriptions; public class InscriptionBounce extends ClassicInscription { @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/inscriptions/InscriptionBounce.java import java.io.IOException; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; package xilef11.mc.runesofwizardry_classics.inscriptions; public class InscriptionBounce extends ClassicInscription { @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(new ResourceLocation(Refs.MODID,"patterns/inscriptions/inscriptionbounce.json"));
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityTrapCage.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // }
import java.util.List; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.WizardryRegistry; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs;
package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntityTrapCage extends RuneEntity { private String user=""; public RuneEntityTrapCage(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override public void onRuneActivatedbyPlayer(EntityPlayer player, ItemStack[] sacrifice, boolean negated) { //nothing here if(!player.world.isRemote)user=player.getName(); } private static final int RADIUS=3; @Override public void update() { World world = entity.getWorld(); if(!world.isRemote){
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityTrapCage.java import java.util.List; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.WizardryRegistry; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntityTrapCage extends RuneEntity { private String user=""; public RuneEntityTrapCage(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override public void onRuneActivatedbyPlayer(EntityPlayer player, ItemStack[] sacrifice, boolean negated) { //nothing here if(!player.world.isRemote)user=player.getName(); } private static final int RADIUS=3; @Override public void update() { World world = entity.getWorld(); if(!world.isRemote){
if(entity.ticksExisted()==5*Refs.TPS)this.renderActive=false;
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityHellstorm.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // }
import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive.BeamType; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.entity.projectile.EntityArrow.PickupStatus; import net.minecraft.entity.projectile.EntityTippedArrow; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs;
package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntityHellstorm extends FueledRuneEntity { public RuneEntityHellstorm(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override protected int initialTicks() {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityHellstorm.java import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive.BeamType; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.entity.projectile.EntityArrow.PickupStatus; import net.minecraft.entity.projectile.EntityTippedArrow; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntityHellstorm extends FueledRuneEntity { public RuneEntityHellstorm(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override protected int initialTicks() {
return Refs.TICKS_PER_DAY/2;
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityHeights.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // }
import java.util.List; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive.BeamType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs;
package xilef11.mc.runesofwizardry_classics.runes.entity; /* * Behaviour: * Rises a 16-block column (moves all blocks in the column on each operations) * Works even if the top is blocked (also moves all blocks in its path) * replaces air + liquids with cobble * Trying to move a TE kills the rune (?) (we could semi-easily move TEs) * breaking the 16th block above the rune brings the column down * Weird behaviour in caves (fills up blocks above its path with cobble) * * Modifications: * breaking the highest moved block in the column will also bring it down */ public class RuneEntityHeights extends RuneEntity { private static final int DEPTH=16;//depth of the column private static final int TICKS_BLOCK=20;//number of ticks between each block lifted public RuneEntityHeights(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override public void onRuneActivatedbyPlayer(EntityPlayer player, ItemStack[] sacrifice, boolean negated) { //get the offset for the beam to be on the column entity.setupBeam(0x72723E, BeamType.BEACON); entity.beamdata.offset=new Vec3d(face.getDirectionVec()); entity.setDrawBeam(true); } private int currentDepth=DEPTH; private int highestBlock=0; private boolean down=false;//is the column going up or down @Override public void update() { World world = entity.getWorld(); if(!world.isRemote){
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityHeights.java import java.util.List; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive.BeamType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; package xilef11.mc.runesofwizardry_classics.runes.entity; /* * Behaviour: * Rises a 16-block column (moves all blocks in the column on each operations) * Works even if the top is blocked (also moves all blocks in its path) * replaces air + liquids with cobble * Trying to move a TE kills the rune (?) (we could semi-easily move TEs) * breaking the 16th block above the rune brings the column down * Weird behaviour in caves (fills up blocks above its path with cobble) * * Modifications: * breaking the highest moved block in the column will also bring it down */ public class RuneEntityHeights extends RuneEntity { private static final int DEPTH=16;//depth of the column private static final int TICKS_BLOCK=20;//number of ticks between each block lifted public RuneEntityHeights(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override public void onRuneActivatedbyPlayer(EntityPlayer player, ItemStack[] sacrifice, boolean negated) { //get the offset for the beam to be on the column entity.setupBeam(0x72723E, BeamType.BEACON); entity.beamdata.offset=new Vec3d(face.getDirectionVec()); entity.setDrawBeam(true); } private int currentDepth=DEPTH; private int highestBlock=0; private boolean down=false;//is the column going up or down @Override public void update() { World world = entity.getWorld(); if(!world.isRemote){
if(entity.ticksExisted()>Refs.TICKS_PER_DAY){
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/VariableRune.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/items/DustVariable.java // public class DustVariable extends DustPlaceholder { // public static DustVariable instance; // /** // */ // public DustVariable() { // super("variable", 0xb92db1, true); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.IDust#dustsMatch(net.minecraft.item.ItemStack, net.minecraft.item.ItemStack) // */ // @Override // public boolean dustsMatch(ItemStack thisDust, ItemStack other) { // return other.getItem() == ClassicDusts.instance; // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // }
import java.util.HashSet; import java.util.Set; import net.minecraft.item.ItemStack; import xilef11.mc.runesofwizardry_classics.items.DustVariable; import xilef11.mc.runesofwizardry_classics.utils.Utils.Coords;
package xilef11.mc.runesofwizardry_classics.runes; /** * Handles Runes with variable dust that must match * @author Xilef11 * */ //FUTURE This would be better as an interface (for RuneEntity) with default values, because we wouldn't need to expose patternMatches in IRune. however, we don't want to be Java 8 only. public abstract class VariableRune extends ClassicRune { private Set<Coords> variables=null; /** * Returns all variable dust positions in this rune. * Not a super efficient default implementation, subclasses should override if they know the variable positions at compile time */ public Set<Coords> getVariableDusts(){ if(variables==null){ variables=new HashSet<>(); ItemStack[][] pattern = getPattern(); for(int r = 0;r<pattern.length;r++){ for(int c=0;c<pattern[r].length;c++){ ItemStack s = pattern[r][c];
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/items/DustVariable.java // public class DustVariable extends DustPlaceholder { // public static DustVariable instance; // /** // */ // public DustVariable() { // super("variable", 0xb92db1, true); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.IDust#dustsMatch(net.minecraft.item.ItemStack, net.minecraft.item.ItemStack) // */ // @Override // public boolean dustsMatch(ItemStack thisDust, ItemStack other) { // return other.getItem() == ClassicDusts.instance; // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/VariableRune.java import java.util.HashSet; import java.util.Set; import net.minecraft.item.ItemStack; import xilef11.mc.runesofwizardry_classics.items.DustVariable; import xilef11.mc.runesofwizardry_classics.utils.Utils.Coords; package xilef11.mc.runesofwizardry_classics.runes; /** * Handles Runes with variable dust that must match * @author Xilef11 * */ //FUTURE This would be better as an interface (for RuneEntity) with default values, because we wouldn't need to expose patternMatches in IRune. however, we don't want to be Java 8 only. public abstract class VariableRune extends ClassicRune { private Set<Coords> variables=null; /** * Returns all variable dust positions in this rune. * Not a super efficient default implementation, subclasses should override if they know the variable positions at compile time */ public Set<Coords> getVariableDusts(){ if(variables==null){ variables=new HashSet<>(); ItemStack[][] pattern = getPattern(); for(int r = 0;r<pattern.length;r++){ for(int c=0;c<pattern[r].length;c++){ ItemStack s = pattern[r][c];
if(s.getItem()==DustVariable.instance){
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneDawn.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityDawn.java // public class RuneEntityDawn extends RuneEntity { // private boolean activatedAtDay=false; // public RuneEntityDawn(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // activatedAtDay=world.isDaytime(); // if(activatedAtDay){ // entity.setupStar(0xFFFFFF,0xFFFFFF); // entity.setDrawStar(true); // } // } // this.renderActive=true; // } // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote){ // if(!world.isDaytime()){//always false on the client // if(entity.beamdata==null){ // entity.setupBeam(0xFFFFCC, BeamType.SPIRAL); // entity.setDrawBeam(true); // entity.setDrawStar(false); // IBlockState state = world.getBlockState(getPos()); // world.notifyBlockUpdate(getPos(), state, state, 3); // } // world.setWorldTime(world.getWorldTime()+25); // activatedAtDay=false;//we got to night time // }else{//if we got to day time // if(!activatedAtDay)this.onPatternBroken(); // } // }else{ // //night: 0.25 to 0.75 // //RunesofWizardry_Classics.log().info(world.getCelestialAngle(0)); // if(world.getCelestialAngle(0)>0.248 && world.getCelestialAngle(0)<0.752)world.setWorldTime(world.getWorldTime()+25); // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void readFromNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // activatedAtDay=compound.getBoolean("dayActivation"); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void writeToNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // compound.setBoolean("dayActivation", activatedAtDay); // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityDawn;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneDawn extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityDawn.java // public class RuneEntityDawn extends RuneEntity { // private boolean activatedAtDay=false; // public RuneEntityDawn(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // activatedAtDay=world.isDaytime(); // if(activatedAtDay){ // entity.setupStar(0xFFFFFF,0xFFFFFF); // entity.setDrawStar(true); // } // } // this.renderActive=true; // } // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote){ // if(!world.isDaytime()){//always false on the client // if(entity.beamdata==null){ // entity.setupBeam(0xFFFFCC, BeamType.SPIRAL); // entity.setDrawBeam(true); // entity.setDrawStar(false); // IBlockState state = world.getBlockState(getPos()); // world.notifyBlockUpdate(getPos(), state, state, 3); // } // world.setWorldTime(world.getWorldTime()+25); // activatedAtDay=false;//we got to night time // }else{//if we got to day time // if(!activatedAtDay)this.onPatternBroken(); // } // }else{ // //night: 0.25 to 0.75 // //RunesofWizardry_Classics.log().info(world.getCelestialAngle(0)); // if(world.getCelestialAngle(0)>0.248 && world.getCelestialAngle(0)<0.752)world.setWorldTime(world.getWorldTime()+25); // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void readFromNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // activatedAtDay=compound.getBoolean("dayActivation"); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void writeToNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // compound.setBoolean("dayActivation", activatedAtDay); // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneDawn.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityDawn; package xilef11.mc.runesofwizardry_classics.runes; public class RuneDawn extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runedawn.json");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneDawn.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityDawn.java // public class RuneEntityDawn extends RuneEntity { // private boolean activatedAtDay=false; // public RuneEntityDawn(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // activatedAtDay=world.isDaytime(); // if(activatedAtDay){ // entity.setupStar(0xFFFFFF,0xFFFFFF); // entity.setDrawStar(true); // } // } // this.renderActive=true; // } // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote){ // if(!world.isDaytime()){//always false on the client // if(entity.beamdata==null){ // entity.setupBeam(0xFFFFCC, BeamType.SPIRAL); // entity.setDrawBeam(true); // entity.setDrawStar(false); // IBlockState state = world.getBlockState(getPos()); // world.notifyBlockUpdate(getPos(), state, state, 3); // } // world.setWorldTime(world.getWorldTime()+25); // activatedAtDay=false;//we got to night time // }else{//if we got to day time // if(!activatedAtDay)this.onPatternBroken(); // } // }else{ // //night: 0.25 to 0.75 // //RunesofWizardry_Classics.log().info(world.getCelestialAngle(0)); // if(world.getCelestialAngle(0)>0.248 && world.getCelestialAngle(0)<0.752)world.setWorldTime(world.getWorldTime()+25); // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void readFromNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // activatedAtDay=compound.getBoolean("dayActivation"); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void writeToNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // compound.setBoolean("dayActivation", activatedAtDay); // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityDawn;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneDawn extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runedawn.json"); } @Override public String getID() { return "runeDawn"; } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,1,0);//dosen't matter for this one, but center is 1,1 } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Items.REDSTONE,4),new ItemStack(Items.DYE,1,EnumDyeColor.BLUE.getMetadata())} }; } @Override public String getName() { return Refs.Lang.RUNE+".dawn"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityDawn.java // public class RuneEntityDawn extends RuneEntity { // private boolean activatedAtDay=false; // public RuneEntityDawn(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // activatedAtDay=world.isDaytime(); // if(activatedAtDay){ // entity.setupStar(0xFFFFFF,0xFFFFFF); // entity.setDrawStar(true); // } // } // this.renderActive=true; // } // @Override // public void update() { // World world = entity.getWorld(); // if(!world.isRemote){ // if(!world.isDaytime()){//always false on the client // if(entity.beamdata==null){ // entity.setupBeam(0xFFFFCC, BeamType.SPIRAL); // entity.setDrawBeam(true); // entity.setDrawStar(false); // IBlockState state = world.getBlockState(getPos()); // world.notifyBlockUpdate(getPos(), state, state, 3); // } // world.setWorldTime(world.getWorldTime()+25); // activatedAtDay=false;//we got to night time // }else{//if we got to day time // if(!activatedAtDay)this.onPatternBroken(); // } // }else{ // //night: 0.25 to 0.75 // //RunesofWizardry_Classics.log().info(world.getCelestialAngle(0)); // if(world.getCelestialAngle(0)>0.248 && world.getCelestialAngle(0)<0.752)world.setWorldTime(world.getWorldTime()+25); // } // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void readFromNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // activatedAtDay=compound.getBoolean("dayActivation"); // } // /* (non-Javadoc) // * @see com.zpig333.runesofwizardry.api.RuneEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound) // */ // @Override // public void writeToNBT(NBTTagCompound compound) { // super.readFromNBT(compound); // compound.setBoolean("dayActivation", activatedAtDay); // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneDawn.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityDawn; package xilef11.mc.runesofwizardry_classics.runes; public class RuneDawn extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runedawn.json"); } @Override public String getID() { return "runeDawn"; } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,1,0);//dosen't matter for this one, but center is 1,1 } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Items.REDSTONE,4),new ItemStack(Items.DYE,1,EnumDyeColor.BLUE.getMetadata())} }; } @Override public String getName() { return Refs.Lang.RUNE+".dawn"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
return new RuneEntityDawn(actualPattern, front, dusts, entity, this);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneFarm.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityFarm.java // public class RuneEntityFarm extends RuneEntity { // public RuneEntityFarm(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, RuneFarm creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @SuppressWarnings("deprecation")//for crop.getStateFromMeta // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // Coords c = ((RuneFarm)creator).getVariableDusts().iterator().next(); // int rad, cropBase, cropRand; // switch(EnumDustTypes.getByMeta(placedPattern[c.row][c.col].getMetadata())){ // case PLANT:rad=1;cropBase=0;cropRand=2; // break; // case GUNPOWDER:rad=2;cropBase=1;cropRand=3; // break; // case LAPIS:rad=3;cropBase=3;cropRand=3; // break; // case BLAZE:rad=4;cropBase=4;cropRand=5; // break; // default:this.onPatternBroken();return; // } // //crops (XXX replace with config stuff...) // Random rand = new Random(); // Block crop=Blocks.WHEAT; // switch(rand.nextInt(4)){ // case 0: crop = Blocks.WHEAT;break; // case 1: crop = Blocks.CARROTS;break; // case 2: crop = Blocks.POTATOES;break; // case 3: crop = Blocks.BEETROOTS;break; // } // this.onPatternBroken();//deactivate the rune before replacing the blocks to avoid errors // //replace with farmland and crops // for(int i=-rad;i<=rad;i++){ // for(int j=-rad;j<=rad;j++){ // if(i!=0||j!=0){ // BlockPos current = getPos().down().east(i).south(j); // Block block = world.getBlockState(current).getBlock(); // if(Config.farmReplaceable.contains(block.getRegistryName().toString())){ // world.setBlockState(current, Blocks.FARMLAND.getDefaultState()); // int meta = cropBase + rand.nextInt(cropRand); // if(meta>7)meta=7;//XXX replace with something like AGE.max value // world.setBlockState(current.up(), crop.getStateFromMeta(meta)); // } // } // } // } // //replace with water // if(Config.farmReplaceable.contains(world.getBlockState(getPos().down()).getBlock().getRegistryName().toString()))world.setBlockState(getPos().down(), Blocks.WATER.getDefaultState()); // world.setBlockToAir(getPos()); // } // } // @Override // public void update() { // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityFarm;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneFarm extends VariableRune { @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityFarm.java // public class RuneEntityFarm extends RuneEntity { // public RuneEntityFarm(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, RuneFarm creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @SuppressWarnings("deprecation")//for crop.getStateFromMeta // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // Coords c = ((RuneFarm)creator).getVariableDusts().iterator().next(); // int rad, cropBase, cropRand; // switch(EnumDustTypes.getByMeta(placedPattern[c.row][c.col].getMetadata())){ // case PLANT:rad=1;cropBase=0;cropRand=2; // break; // case GUNPOWDER:rad=2;cropBase=1;cropRand=3; // break; // case LAPIS:rad=3;cropBase=3;cropRand=3; // break; // case BLAZE:rad=4;cropBase=4;cropRand=5; // break; // default:this.onPatternBroken();return; // } // //crops (XXX replace with config stuff...) // Random rand = new Random(); // Block crop=Blocks.WHEAT; // switch(rand.nextInt(4)){ // case 0: crop = Blocks.WHEAT;break; // case 1: crop = Blocks.CARROTS;break; // case 2: crop = Blocks.POTATOES;break; // case 3: crop = Blocks.BEETROOTS;break; // } // this.onPatternBroken();//deactivate the rune before replacing the blocks to avoid errors // //replace with farmland and crops // for(int i=-rad;i<=rad;i++){ // for(int j=-rad;j<=rad;j++){ // if(i!=0||j!=0){ // BlockPos current = getPos().down().east(i).south(j); // Block block = world.getBlockState(current).getBlock(); // if(Config.farmReplaceable.contains(block.getRegistryName().toString())){ // world.setBlockState(current, Blocks.FARMLAND.getDefaultState()); // int meta = cropBase + rand.nextInt(cropRand); // if(meta>7)meta=7;//XXX replace with something like AGE.max value // world.setBlockState(current.up(), crop.getStateFromMeta(meta)); // } // } // } // } // //replace with water // if(Config.farmReplaceable.contains(world.getBlockState(getPos().down()).getBlock().getRegistryName().toString()))world.setBlockState(getPos().down(), Blocks.WATER.getDefaultState()); // world.setBlockToAir(getPos()); // } // } // @Override // public void update() { // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneFarm.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityFarm; package xilef11.mc.runesofwizardry_classics.runes; public class RuneFarm extends VariableRune { @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runefarm.json");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneFarm.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityFarm.java // public class RuneEntityFarm extends RuneEntity { // public RuneEntityFarm(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, RuneFarm creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @SuppressWarnings("deprecation")//for crop.getStateFromMeta // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // Coords c = ((RuneFarm)creator).getVariableDusts().iterator().next(); // int rad, cropBase, cropRand; // switch(EnumDustTypes.getByMeta(placedPattern[c.row][c.col].getMetadata())){ // case PLANT:rad=1;cropBase=0;cropRand=2; // break; // case GUNPOWDER:rad=2;cropBase=1;cropRand=3; // break; // case LAPIS:rad=3;cropBase=3;cropRand=3; // break; // case BLAZE:rad=4;cropBase=4;cropRand=5; // break; // default:this.onPatternBroken();return; // } // //crops (XXX replace with config stuff...) // Random rand = new Random(); // Block crop=Blocks.WHEAT; // switch(rand.nextInt(4)){ // case 0: crop = Blocks.WHEAT;break; // case 1: crop = Blocks.CARROTS;break; // case 2: crop = Blocks.POTATOES;break; // case 3: crop = Blocks.BEETROOTS;break; // } // this.onPatternBroken();//deactivate the rune before replacing the blocks to avoid errors // //replace with farmland and crops // for(int i=-rad;i<=rad;i++){ // for(int j=-rad;j<=rad;j++){ // if(i!=0||j!=0){ // BlockPos current = getPos().down().east(i).south(j); // Block block = world.getBlockState(current).getBlock(); // if(Config.farmReplaceable.contains(block.getRegistryName().toString())){ // world.setBlockState(current, Blocks.FARMLAND.getDefaultState()); // int meta = cropBase + rand.nextInt(cropRand); // if(meta>7)meta=7;//XXX replace with something like AGE.max value // world.setBlockState(current.up(), crop.getStateFromMeta(meta)); // } // } // } // } // //replace with water // if(Config.farmReplaceable.contains(world.getBlockState(getPos().down()).getBlock().getRegistryName().toString()))world.setBlockState(getPos().down(), Blocks.WATER.getDefaultState()); // world.setBlockToAir(getPos()); // } // } // @Override // public void update() { // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityFarm;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneFarm extends VariableRune { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runefarm.json"); } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,1,0); } @Override public String getID() { return "runeFarm"; } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Items.IRON_INGOT,8)} }; } @Override public String getName() { return Refs.Lang.RUNE+".farm"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityFarm.java // public class RuneEntityFarm extends RuneEntity { // public RuneEntityFarm(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, RuneFarm creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @SuppressWarnings("deprecation")//for crop.getStateFromMeta // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // Coords c = ((RuneFarm)creator).getVariableDusts().iterator().next(); // int rad, cropBase, cropRand; // switch(EnumDustTypes.getByMeta(placedPattern[c.row][c.col].getMetadata())){ // case PLANT:rad=1;cropBase=0;cropRand=2; // break; // case GUNPOWDER:rad=2;cropBase=1;cropRand=3; // break; // case LAPIS:rad=3;cropBase=3;cropRand=3; // break; // case BLAZE:rad=4;cropBase=4;cropRand=5; // break; // default:this.onPatternBroken();return; // } // //crops (XXX replace with config stuff...) // Random rand = new Random(); // Block crop=Blocks.WHEAT; // switch(rand.nextInt(4)){ // case 0: crop = Blocks.WHEAT;break; // case 1: crop = Blocks.CARROTS;break; // case 2: crop = Blocks.POTATOES;break; // case 3: crop = Blocks.BEETROOTS;break; // } // this.onPatternBroken();//deactivate the rune before replacing the blocks to avoid errors // //replace with farmland and crops // for(int i=-rad;i<=rad;i++){ // for(int j=-rad;j<=rad;j++){ // if(i!=0||j!=0){ // BlockPos current = getPos().down().east(i).south(j); // Block block = world.getBlockState(current).getBlock(); // if(Config.farmReplaceable.contains(block.getRegistryName().toString())){ // world.setBlockState(current, Blocks.FARMLAND.getDefaultState()); // int meta = cropBase + rand.nextInt(cropRand); // if(meta>7)meta=7;//XXX replace with something like AGE.max value // world.setBlockState(current.up(), crop.getStateFromMeta(meta)); // } // } // } // } // //replace with water // if(Config.farmReplaceable.contains(world.getBlockState(getPos().down()).getBlock().getRegistryName().toString()))world.setBlockState(getPos().down(), Blocks.WATER.getDefaultState()); // world.setBlockToAir(getPos()); // } // } // @Override // public void update() { // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneFarm.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityFarm; package xilef11.mc.runesofwizardry_classics.runes; public class RuneFarm extends VariableRune { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runefarm.json"); } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,1,0); } @Override public String getID() { return "runeFarm"; } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Items.IRON_INGOT,8)} }; } @Override public String getName() { return Refs.Lang.RUNE+".farm"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
return new RuneEntityFarm(actualPattern, front, dusts, entity, this);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityCompression.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.utils.Utils;
package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntityCompression extends RuneEntity { public RuneEntityCompression(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { World world = player.world; if(!world.isRemote){ int numCoal=0; for(ItemStack i:sacrifice){ if(i.getItem()==Items.COAL)numCoal+=i.getCount(); } if(negated && numCoal==0)numCoal=32; int numDiamonds = numCoal/32; while(numDiamonds>64){
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityCompression.java import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.utils.Utils; package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntityCompression extends RuneEntity { public RuneEntityCompression(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } @Override public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { World world = player.world; if(!world.isRemote){ int numCoal=0; for(ItemStack i:sacrifice){ if(i.getItem()==Items.COAL)numCoal+=i.getCount(); } if(negated && numCoal==0)numCoal=32; int numDiamonds = numCoal/32; while(numDiamonds>64){
Utils.spawnItemCentered(world, getPos(), new ItemStack(Items.DIAMOND,64));
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/inscriptions/InscriptionLeapII.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.io.IOException; import com.zpig333.runesofwizardry.api.DustRegistry; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils;
package xilef11.mc.runesofwizardry_classics.inscriptions; public class InscriptionLeapII extends InscriptionLeap { public InscriptionLeapII(){ super(1.85,4); MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void onJump(LivingJumpEvent event){ EntityLivingBase ent = event.getEntityLiving(); if(ent instanceof EntityPlayer){ EntityPlayer player = (EntityPlayer)ent; ItemStack worn = DustRegistry.getWornInscription(player); if(!player.isSneaking()&&DustRegistry.getInscriptionFromStack(worn)==this){ //player.jumpMovementFactor=1.5F; player.addVelocity(0, 0.025, 0); player.velocityChanged=true; } } } @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/inscriptions/InscriptionLeapII.java import java.io.IOException; import com.zpig333.runesofwizardry.api.DustRegistry; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils; package xilef11.mc.runesofwizardry_classics.inscriptions; public class InscriptionLeapII extends InscriptionLeap { public InscriptionLeapII(){ super(1.85,4); MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void onJump(LivingJumpEvent event){ EntityLivingBase ent = event.getEntityLiving(); if(ent instanceof EntityPlayer){ EntityPlayer player = (EntityPlayer)ent; ItemStack worn = DustRegistry.getWornInscription(player); if(!player.isSneaking()&&DustRegistry.getInscriptionFromStack(worn)==this){ //player.jumpMovementFactor=1.5F; player.addVelocity(0, 0.025, 0); player.velocityChanged=true; } } } @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(new ResourceLocation(Refs.MODID,"patterns/inscriptions/inscriptionleapii.json"));
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/inscriptions/InscriptionLeapII.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.io.IOException; import com.zpig333.runesofwizardry.api.DustRegistry; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils;
return PatternUtils.importFromJson(new ResourceLocation(Refs.MODID,"patterns/inscriptions/inscriptionleapii.json")); } @Override protected ItemStack[] setupChargeItems() { ItemStack slimeEgg = new ItemStack(Items.SPAWN_EGG); NBTTagCompound id = new NBTTagCompound(); id.setString("id", "Slime"); NBTTagCompound main = new NBTTagCompound(); main.setTag("EntityTag", id); slimeEgg.setTagCompound(main); return new ItemStack[]{slimeEgg,new ItemStack(Items.FEATHER,4),new ItemStack(Items.FIREWORKS)}; //+7 xp } /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.inscriptions.ClassicInscription#hasExtraSacrifice() */ @Override protected boolean hasExtraSacrifice() { return true; } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.Inscription#onInscriptionCharged(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) */ @Override public boolean onInscriptionCharged(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { if(!player.world.isRemote){ if(!negated){
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/inscriptions/InscriptionLeapII.java import java.io.IOException; import com.zpig333.runesofwizardry.api.DustRegistry; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils; return PatternUtils.importFromJson(new ResourceLocation(Refs.MODID,"patterns/inscriptions/inscriptionleapii.json")); } @Override protected ItemStack[] setupChargeItems() { ItemStack slimeEgg = new ItemStack(Items.SPAWN_EGG); NBTTagCompound id = new NBTTagCompound(); id.setString("id", "Slime"); NBTTagCompound main = new NBTTagCompound(); main.setTag("EntityTag", id); slimeEgg.setTagCompound(main); return new ItemStack[]{slimeEgg,new ItemStack(Items.FEATHER,4),new ItemStack(Items.FIREWORKS)}; //+7 xp } /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.inscriptions.ClassicInscription#hasExtraSacrifice() */ @Override protected boolean hasExtraSacrifice() { return true; } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.Inscription#onInscriptionCharged(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) */ @Override public boolean onInscriptionCharged(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { if(!player.world.isRemote){ if(!negated){
return Utils.takeXP(player, 12);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/items/EnumDustTypes.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // }
import net.minecraft.item.ItemStack; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics;
/** * */ package xilef11.mc.runesofwizardry_classics.items; /** * @author Xilef11 * */ public enum EnumDustTypes { PLANT (0x629B26, 0x8AD041, 0xC2E300), GUNPOWDER(0x696969, 0x979797, 0x666464), LAPIS(0x345EC3, 0x5A82E2, 0x0087FF), BLAZE(0xEA8A00, 0xFFFE31, 0xFF6E1E); /* * In order of least valuable to most valuable: 2xTall Grass or Saplings or Leaves or Seeds + 1xCoal = 8xPlant Runic Dust 2xPlant Runic Dust + 1xGunpowder = 12xGunpowder Runic Dust 3xLapis + 1xCoal = 8xLapis Runic Dust 3xLapis Runic Dust + 1xBlaze Powder = 12xBlaze Runic Dust */ public final int primaryColor, secondaryColor,floorColor; //constructor for our dust types EnumDustTypes(int primaryColor, int secondaryColor,int floorColor){ this.primaryColor=primaryColor; this.secondaryColor=secondaryColor; this.floorColor = floorColor; } /** returns the metadata value associated with a dust type **/ public int meta(){ return this.ordinal(); } public ItemStack getStack(int amount){ return new ItemStack(ClassicDusts.instance,amount,this.meta()); } /** returns the dust type associated with the given meta **/ public static EnumDustTypes getByMeta(int meta){ if(meta>=EnumDustTypes.values().length){ IllegalArgumentException e = new IllegalArgumentException("meta: "+meta);
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/RunesofWizardry_Classics.java // @Mod(modid = Refs.MODID, version = Refs.VERSION, name=Refs.NAME, guiFactory=Refs.GUI_FACTORY, dependencies = "required-after:runesofwizardry;after:guideapi") // public class RunesofWizardry_Classics // { // @SidedProxy(clientSide=Refs.CLIENT_PROXY,serverSide=Refs.SERVER_PROXY) // public static IProxy proxy; // // private static Logger logger; // /**Returns the logger for the mod**/ // public static Logger log(){return logger;} // // @EventHandler // public void preInit(FMLPreInitializationEvent event){ // logger = event.getModLog(); // RunesofWizardry_Classics.log().info("Registering Classic dusts"); // ClassicDusts.instance = new ClassicDusts(); // DustRegistry.registerDust(ClassicDusts.instance); // DustVariable.instance=new DustVariable(); // DustRegistry.registerDust(DustVariable.instance); // //init the runes // ModRunes.initRunes(); // ModInscriptions.initInscriptions(); // //register the config // Config.init(event.getSuggestedConfigurationFile()); // MinecraftForge.EVENT_BUS.register(new Config()); // } // @EventHandler // public void init(FMLInitializationEvent event) // { // //register the runes // ModRunes.registerRunes(); // ModInscriptions.registerInscriptions(); // } // @EventHandler // public void postInit(FMLPostInitializationEvent event){ // if(Loader.isModLoaded("guideapi")){ // GuideBookAdditions.handlePost(); // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/items/EnumDustTypes.java import net.minecraft.item.ItemStack; import xilef11.mc.runesofwizardry_classics.RunesofWizardry_Classics; /** * */ package xilef11.mc.runesofwizardry_classics.items; /** * @author Xilef11 * */ public enum EnumDustTypes { PLANT (0x629B26, 0x8AD041, 0xC2E300), GUNPOWDER(0x696969, 0x979797, 0x666464), LAPIS(0x345EC3, 0x5A82E2, 0x0087FF), BLAZE(0xEA8A00, 0xFFFE31, 0xFF6E1E); /* * In order of least valuable to most valuable: 2xTall Grass or Saplings or Leaves or Seeds + 1xCoal = 8xPlant Runic Dust 2xPlant Runic Dust + 1xGunpowder = 12xGunpowder Runic Dust 3xLapis + 1xCoal = 8xLapis Runic Dust 3xLapis Runic Dust + 1xBlaze Powder = 12xBlaze Runic Dust */ public final int primaryColor, secondaryColor,floorColor; //constructor for our dust types EnumDustTypes(int primaryColor, int secondaryColor,int floorColor){ this.primaryColor=primaryColor; this.secondaryColor=secondaryColor; this.floorColor = floorColor; } /** returns the metadata value associated with a dust type **/ public int meta(){ return this.ordinal(); } public ItemStack getStack(int amount){ return new ItemStack(ClassicDusts.instance,amount,this.meta()); } /** returns the dust type associated with the given meta **/ public static EnumDustTypes getByMeta(int meta){ if(meta>=EnumDustTypes.values().length){ IllegalArgumentException e = new IllegalArgumentException("meta: "+meta);
RunesofWizardry_Classics.log().error("Invalid Classic Dusts metadata",e);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneSpeed.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySpeed.java // public class RuneEntitySpeed extends RuneEntity { // public RuneEntitySpeed(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, RuneSpeed creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // if(!player.world.isRemote){ // Coords p = ((RuneSpeed)creator).getVariableDusts().iterator().next(); // ItemStack stack = placedPattern[p.row][p.col]; // int power,duration; // switch(EnumDustTypes.getByMeta(stack.getMetadata())){ // case PLANT: power=1 ; duration=20*30; // break; // case GUNPOWDER: power=1 ; duration=20*60; // break; // case LAPIS: power=2 ; duration=20*120; // break; // case BLAZE: power=4 ; duration=20*180; // break; // default: power=duration=0; // break; // } // //the original was activatable by redstone and gave the effect to all entityliving on the rune // player.addPotionEffect(new PotionEffect(MobEffects.SPEED, duration, power)); // } // } // @Override // public void update() { // if(entity.ticksExisted()==2*Refs.TPS && !entity.getWorld().isRemote)this.onPatternBroken(); // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntitySpeed;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneSpeed extends VariableRune { @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySpeed.java // public class RuneEntitySpeed extends RuneEntity { // public RuneEntitySpeed(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, RuneSpeed creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // if(!player.world.isRemote){ // Coords p = ((RuneSpeed)creator).getVariableDusts().iterator().next(); // ItemStack stack = placedPattern[p.row][p.col]; // int power,duration; // switch(EnumDustTypes.getByMeta(stack.getMetadata())){ // case PLANT: power=1 ; duration=20*30; // break; // case GUNPOWDER: power=1 ; duration=20*60; // break; // case LAPIS: power=2 ; duration=20*120; // break; // case BLAZE: power=4 ; duration=20*180; // break; // default: power=duration=0; // break; // } // //the original was activatable by redstone and gave the effect to all entityliving on the rune // player.addPotionEffect(new PotionEffect(MobEffects.SPEED, duration, power)); // } // } // @Override // public void update() { // if(entity.ticksExisted()==2*Refs.TPS && !entity.getWorld().isRemote)this.onPatternBroken(); // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneSpeed.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntitySpeed; package xilef11.mc.runesofwizardry_classics.runes; public class RuneSpeed extends VariableRune { @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runespeed.json");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneSpeed.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySpeed.java // public class RuneEntitySpeed extends RuneEntity { // public RuneEntitySpeed(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, RuneSpeed creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // if(!player.world.isRemote){ // Coords p = ((RuneSpeed)creator).getVariableDusts().iterator().next(); // ItemStack stack = placedPattern[p.row][p.col]; // int power,duration; // switch(EnumDustTypes.getByMeta(stack.getMetadata())){ // case PLANT: power=1 ; duration=20*30; // break; // case GUNPOWDER: power=1 ; duration=20*60; // break; // case LAPIS: power=2 ; duration=20*120; // break; // case BLAZE: power=4 ; duration=20*180; // break; // default: power=duration=0; // break; // } // //the original was activatable by redstone and gave the effect to all entityliving on the rune // player.addPotionEffect(new PotionEffect(MobEffects.SPEED, duration, power)); // } // } // @Override // public void update() { // if(entity.ticksExisted()==2*Refs.TPS && !entity.getWorld().isRemote)this.onPatternBroken(); // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntitySpeed;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneSpeed extends VariableRune { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runespeed.json"); } @Override public String getID() { return "runeSpeed"; } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,0,0); } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Items.SUGAR,3),new ItemStack(Items.BLAZE_POWDER)} }; } @Override public String getName() { return Refs.Lang.RUNE+".speed"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySpeed.java // public class RuneEntitySpeed extends RuneEntity { // public RuneEntitySpeed(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, RuneSpeed creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // if(!player.world.isRemote){ // Coords p = ((RuneSpeed)creator).getVariableDusts().iterator().next(); // ItemStack stack = placedPattern[p.row][p.col]; // int power,duration; // switch(EnumDustTypes.getByMeta(stack.getMetadata())){ // case PLANT: power=1 ; duration=20*30; // break; // case GUNPOWDER: power=1 ; duration=20*60; // break; // case LAPIS: power=2 ; duration=20*120; // break; // case BLAZE: power=4 ; duration=20*180; // break; // default: power=duration=0; // break; // } // //the original was activatable by redstone and gave the effect to all entityliving on the rune // player.addPotionEffect(new PotionEffect(MobEffects.SPEED, duration, power)); // } // } // @Override // public void update() { // if(entity.ticksExisted()==2*Refs.TPS && !entity.getWorld().isRemote)this.onPatternBroken(); // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneSpeed.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntitySpeed; package xilef11.mc.runesofwizardry_classics.runes; public class RuneSpeed extends VariableRune { @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runespeed.json"); } @Override public String getID() { return "runeSpeed"; } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,0,0); } @Override protected ItemStack[][] setupSacrifice() { return new ItemStack[][]{ {new ItemStack(Items.SUGAR,3),new ItemStack(Items.BLAZE_POWDER)} }; } @Override public String getName() { return Refs.Lang.RUNE+".speed"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
return new RuneEntitySpeed(actualPattern, front, dusts, entity, this);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySpriteFire.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.util.List; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils;
package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntitySpriteFire extends FueledRuneEntity { public RuneEntitySpriteFire(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } private String activatingPlayer; @Override protected int initialTicks() {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySpriteFire.java import java.util.List; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils; package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntitySpriteFire extends FueledRuneEntity { public RuneEntitySpriteFire(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } private String activatingPlayer; @Override protected int initialTicks() {
return Refs.TICKS_PER_DAY*3;
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySpriteFire.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.util.List; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils;
package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntitySpriteFire extends FueledRuneEntity { public RuneEntitySpriteFire(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } private String activatingPlayer; @Override protected int initialTicks() { return Refs.TICKS_PER_DAY*3; } /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.runes.entity.FueledRuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) */ @Override public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { if(!player.world.isRemote){
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntitySpriteFire.java import java.util.List; import java.util.Set; import com.zpig333.runesofwizardry.api.IRune; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils; package xilef11.mc.runesofwizardry_classics.runes.entity; public class RuneEntitySpriteFire extends FueledRuneEntity { public RuneEntitySpriteFire(ItemStack[][] actualPattern, EnumFacing facing, Set<BlockPos> dusts, TileEntityDustActive entity, IRune creator) { super(actualPattern, facing, dusts, entity, creator); } private String activatingPlayer; @Override protected int initialTicks() { return Refs.TICKS_PER_DAY*3; } /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.runes.entity.FueledRuneEntity#onRuneActivatedbyPlayer(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) */ @Override public void onRuneActivatedbyPlayer(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { if(!player.world.isRemote){
if(!(negated || Utils.takeXP(player, 22))){
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneEnchantingFortune.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityEnchantingFortune.java // public class RuneEntityEnchantingFortune extends RuneEntity { // public RuneEntityEnchantingFortune(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, // TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // if(negated || Utils.takeXP(player, 15)){ // //find the bow stack // ItemStack toEnchant=ItemStack.EMPTY; // boolean sword=false; // if(sacrifice!=null){ // for(ItemStack i:sacrifice){ // if(i.getItem()==Items.DIAMOND_PICKAXE){ // toEnchant=i; // sword=false; // } // if(i.getItem()==Items.DIAMOND_SWORD){ // toEnchant=i; // sword=true; // } // } // } // if(toEnchant.isEmpty() && negated)toEnchant=new ItemStack(Items.DIAMOND_PICKAXE); // if(!sword)toEnchant.addEnchantment(Enchantments.FORTUNE, Enchantments.FORTUNE.getMaxLevel()+1); // else toEnchant.addEnchantment(Enchantments.LOOTING, Enchantments.LOOTING.getMaxLevel()+1); // toEnchant.setItemDamage(0); // Utils.spawnItemCentered(world, getPos(), toEnchant); // this.onPatternBroken(); // }else{ // this.onPatternBrokenByPlayer(player); // } // } // } // @Override // public void update() { // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import net.minecraftforge.oredict.OreDictionary; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityEnchantingFortune;
package xilef11.mc.runesofwizardry_classics.runes; public class RuneEnchantingFortune extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityEnchantingFortune.java // public class RuneEntityEnchantingFortune extends RuneEntity { // public RuneEntityEnchantingFortune(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, // TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // if(negated || Utils.takeXP(player, 15)){ // //find the bow stack // ItemStack toEnchant=ItemStack.EMPTY; // boolean sword=false; // if(sacrifice!=null){ // for(ItemStack i:sacrifice){ // if(i.getItem()==Items.DIAMOND_PICKAXE){ // toEnchant=i; // sword=false; // } // if(i.getItem()==Items.DIAMOND_SWORD){ // toEnchant=i; // sword=true; // } // } // } // if(toEnchant.isEmpty() && negated)toEnchant=new ItemStack(Items.DIAMOND_PICKAXE); // if(!sword)toEnchant.addEnchantment(Enchantments.FORTUNE, Enchantments.FORTUNE.getMaxLevel()+1); // else toEnchant.addEnchantment(Enchantments.LOOTING, Enchantments.LOOTING.getMaxLevel()+1); // toEnchant.setItemDamage(0); // Utils.spawnItemCentered(world, getPos(), toEnchant); // this.onPatternBroken(); // }else{ // this.onPatternBrokenByPlayer(player); // } // } // } // @Override // public void update() { // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneEnchantingFortune.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import net.minecraftforge.oredict.OreDictionary; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityEnchantingFortune; package xilef11.mc.runesofwizardry_classics.runes; public class RuneEnchantingFortune extends ClassicRune { @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(Refs.PATTERN_PATH+"runeenchantingfortune.json");
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneEnchantingFortune.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityEnchantingFortune.java // public class RuneEntityEnchantingFortune extends RuneEntity { // public RuneEntityEnchantingFortune(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, // TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // if(negated || Utils.takeXP(player, 15)){ // //find the bow stack // ItemStack toEnchant=ItemStack.EMPTY; // boolean sword=false; // if(sacrifice!=null){ // for(ItemStack i:sacrifice){ // if(i.getItem()==Items.DIAMOND_PICKAXE){ // toEnchant=i; // sword=false; // } // if(i.getItem()==Items.DIAMOND_SWORD){ // toEnchant=i; // sword=true; // } // } // } // if(toEnchant.isEmpty() && negated)toEnchant=new ItemStack(Items.DIAMOND_PICKAXE); // if(!sword)toEnchant.addEnchantment(Enchantments.FORTUNE, Enchantments.FORTUNE.getMaxLevel()+1); // else toEnchant.addEnchantment(Enchantments.LOOTING, Enchantments.LOOTING.getMaxLevel()+1); // toEnchant.setItemDamage(0); // Utils.spawnItemCentered(world, getPos(), toEnchant); // this.onPatternBroken(); // }else{ // this.onPatternBrokenByPlayer(player); // } // } // } // @Override // public void update() { // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import net.minecraftforge.oredict.OreDictionary; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityEnchantingFortune;
public String getID() { return "runeEnchantingFortune"; } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,1,0); } @Override protected ItemStack[][] setupSacrifice() { //FIXME somehow this accepted a shovel return new ItemStack[][]{ {new ItemStack(Blocks.DIAMOND_ORE),new ItemStack(Blocks.LAPIS_ORE),new ItemStack(Blocks.REDSTONE_ORE),new ItemStack(Items.DIAMOND_PICKAXE,1,OreDictionary.WILDCARD_VALUE)}, {new ItemStack(Blocks.DIAMOND_ORE),new ItemStack(Blocks.LAPIS_ORE),new ItemStack(Blocks.REDSTONE_ORE),new ItemStack(Items.DIAMOND_SWORD,1,OreDictionary.WILDCARD_VALUE)} }; //take 15 XP } /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.runes.ClassicRune#hasExtraSacrifice() */ @Override protected boolean hasExtraSacrifice() { return true; } @Override public String getName() { return Refs.Lang.RUNE+".enchantingfortune"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityEnchantingFortune.java // public class RuneEntityEnchantingFortune extends RuneEntity { // public RuneEntityEnchantingFortune(ItemStack[][] actualPattern, // EnumFacing facing, Set<BlockPos> dusts, // TileEntityDustActive entity, IRune creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // World world = player.world; // if(!world.isRemote){ // if(negated || Utils.takeXP(player, 15)){ // //find the bow stack // ItemStack toEnchant=ItemStack.EMPTY; // boolean sword=false; // if(sacrifice!=null){ // for(ItemStack i:sacrifice){ // if(i.getItem()==Items.DIAMOND_PICKAXE){ // toEnchant=i; // sword=false; // } // if(i.getItem()==Items.DIAMOND_SWORD){ // toEnchant=i; // sword=true; // } // } // } // if(toEnchant.isEmpty() && negated)toEnchant=new ItemStack(Items.DIAMOND_PICKAXE); // if(!sword)toEnchant.addEnchantment(Enchantments.FORTUNE, Enchantments.FORTUNE.getMaxLevel()+1); // else toEnchant.addEnchantment(Enchantments.LOOTING, Enchantments.LOOTING.getMaxLevel()+1); // toEnchant.setItemDamage(0); // Utils.spawnItemCentered(world, getPos(), toEnchant); // this.onPatternBroken(); // }else{ // this.onPatternBrokenByPlayer(player); // } // } // } // @Override // public void update() { // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneEnchantingFortune.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import net.minecraftforge.oredict.OreDictionary; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityEnchantingFortune; public String getID() { return "runeEnchantingFortune"; } @Override protected Vec3i setupEntityPos() { return new Vec3i(1,1,0); } @Override protected ItemStack[][] setupSacrifice() { //FIXME somehow this accepted a shovel return new ItemStack[][]{ {new ItemStack(Blocks.DIAMOND_ORE),new ItemStack(Blocks.LAPIS_ORE),new ItemStack(Blocks.REDSTONE_ORE),new ItemStack(Items.DIAMOND_PICKAXE,1,OreDictionary.WILDCARD_VALUE)}, {new ItemStack(Blocks.DIAMOND_ORE),new ItemStack(Blocks.LAPIS_ORE),new ItemStack(Blocks.REDSTONE_ORE),new ItemStack(Items.DIAMOND_SWORD,1,OreDictionary.WILDCARD_VALUE)} }; //take 15 XP } /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.runes.ClassicRune#hasExtraSacrifice() */ @Override protected boolean hasExtraSacrifice() { return true; } @Override public String getName() { return Refs.Lang.RUNE+".enchantingfortune"; } @Override public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front, Set<BlockPos> dusts, TileEntityDustActive entity) {
return new RuneEntityEnchantingFortune(actualPattern, front, dusts, entity, this);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/inscriptions/InscriptionBlinkII.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.io.IOException; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils;
package xilef11.mc.runesofwizardry_classics.inscriptions; public class InscriptionBlinkII extends ClassicInscription { //also has a particle effect at the teleport destination @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/inscriptions/InscriptionBlinkII.java import java.io.IOException; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils; package xilef11.mc.runesofwizardry_classics.inscriptions; public class InscriptionBlinkII extends ClassicInscription { //also has a particle effect at the teleport destination @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(new ResourceLocation(Refs.MODID,"patterns/inscriptions/inscriptionblinkii.json"));
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/inscriptions/InscriptionBlinkII.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // }
import java.io.IOException; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils;
package xilef11.mc.runesofwizardry_classics.inscriptions; public class InscriptionBlinkII extends ClassicInscription { //also has a particle effect at the teleport destination @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(new ResourceLocation(Refs.MODID,"patterns/inscriptions/inscriptionblinkii.json")); } @Override protected ItemStack[] setupChargeItems() { return new ItemStack[]{ new ItemStack(Blocks.QUARTZ_BLOCK), new ItemStack(Items.BLAZE_ROD,2), new ItemStack(Items.ENDER_PEARL,16), new ItemStack(Blocks.OBSIDIAN,4), new ItemStack(Blocks.END_STONE,8) };//10 xp } /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.inscriptions.ClassicInscription#hasExtraSacrifice() */ @Override protected boolean hasExtraSacrifice() { return true; } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.Inscription#onInscriptionCharged(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) */ @Override public boolean onInscriptionCharged(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { if(!player.world.isRemote){ if(!negated){
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/utils/Utils.java // public class Utils { // private Utils(){} // public static void spawnItemCentered(World world, BlockPos pos, ItemStack stack){ // EntityItem item = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); // item.setDefaultPickupDelay(); // world.spawnEntity(item); // } // /** // * Attempts to remove experience levels from the player. // * @param player the player from which to take XP // * @param levels the number of XP levels to take // * @return true if the levels have been removed, false if the player didn't have enough // */ // public static boolean takeXP(EntityPlayer player, int levels){ // if(player.capabilities.isCreativeMode)return true; // boolean enough =player.experienceLevel>=levels; // if(enough){ // player.addExperienceLevel(-levels); // } // return enough; // } // /** stores coordinates for an array or whatever**/ // public static class Coords{ // public final int row,col; // public Coords(int r, int c) { // this.row = r; // this.col = c; // } // /* (non-Javadoc) // * @see java.lang.Object#hashCode() // */ // @Override // public int hashCode() { // return row+col;//not the best, but should be sufficient // } // /* (non-Javadoc) // * @see java.lang.Object#equals(java.lang.Object) // */ // @Override // public boolean equals(Object obj) { // if(obj==this)return true; // if(!(obj instanceof Coords))return false; // Coords o = (Coords)obj; // return this.row==o.row && this.col==o.col; // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/inscriptions/InscriptionBlinkII.java import java.io.IOException; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.utils.Utils; package xilef11.mc.runesofwizardry_classics.inscriptions; public class InscriptionBlinkII extends ClassicInscription { //also has a particle effect at the teleport destination @Override protected ItemStack[][] setupPattern() throws IOException { return PatternUtils.importFromJson(new ResourceLocation(Refs.MODID,"patterns/inscriptions/inscriptionblinkii.json")); } @Override protected ItemStack[] setupChargeItems() { return new ItemStack[]{ new ItemStack(Blocks.QUARTZ_BLOCK), new ItemStack(Items.BLAZE_ROD,2), new ItemStack(Items.ENDER_PEARL,16), new ItemStack(Blocks.OBSIDIAN,4), new ItemStack(Blocks.END_STONE,8) };//10 xp } /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.inscriptions.ClassicInscription#hasExtraSacrifice() */ @Override protected boolean hasExtraSacrifice() { return true; } /* (non-Javadoc) * @see com.zpig333.runesofwizardry.api.Inscription#onInscriptionCharged(net.minecraft.entity.player.EntityPlayer, net.minecraft.item.ItemStack[], boolean) */ @Override public boolean onInscriptionCharged(EntityPlayer player,ItemStack[] sacrifice, boolean negated) { if(!player.world.isRemote){ if(!negated){
return Utils.takeXP(player, 20);
Xilef11/runesofwizardry-classics
src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneHealing.java
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityHealing.java // public class RuneEntityHealing extends RuneEntity { // public RuneEntityHealing(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, RuneHealing creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // World world = player.world; // System.out.println("WTF"); // if(!world.isRemote){ // if(!(negated || Utils.takeXP(player, 2))){ // this.onPatternBrokenByPlayer(player); // return; // } // Coords var = ((RuneHealing)creator).getVariableDusts().iterator().next(); // int duration,power,food; // float sat; // switch(EnumDustTypes.getByMeta(placedPattern[var.row][var.col].getMetadata())){ // case PLANT: duration=4;power=1;food=0;sat=0;//gives regen 1 // break; // case GUNPOWDER: duration=5;power=2;food=0;sat=0;//gives regen 2 // break; // case LAPIS: duration=10;power=2;food=5;sat=0.6F; // break; // case BLAZE: duration=32;power=4;food=8;sat=0.8F;//gives regen 4 (regen 5 just gives regen 1) // break; // default: duration=power=0;food=0;sat=0; // break; // } // List<EntityLivingBase> ents = world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPos().add(-3, -1, -3), getPos().add(3,1,3))); // for(EntityLivingBase e:ents){ // e.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, duration*20, power-1)); // if(e instanceof EntityPlayer){ // EntityPlayer p = (EntityPlayer)e; // p.getFoodStats().addStats(food, sat); // } // } // } // } // @Override // public void update() { // if(entity.ticksExisted()>=100){ // this.onPatternBroken(); // } // } // }
import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityHealing;
/** * */ package xilef11.mc.runesofwizardry_classics.runes; /** * @author Xilef11 * */ public class RuneHealing extends VariableRune { /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.runes.ClassicRune#setupPattern() */ @Override protected ItemStack[][] setupPattern() throws IOException {
// Path: src/main/java/xilef11/mc/runesofwizardry_classics/Refs.java // public final class Refs { // private Refs(){} // public static final String MODID = "runesofwizardry_classics"; // public static final String VERSION = "@VERSION@"; // public static final String NAME="Runes of Wizardry - Classic Dusts Pack"; // public static final String GUI_FACTORY="xilef11.mc.runesofwizardry_classics.client.gui.GuiFactory"; // public static final String CLIENT_PROXY = "xilef11.mc.runesofwizardry_classics.proxy.ClientProxy", // SERVER_PROXY="xilef11.mc.runesofwizardry_classics.proxy.ServerProxy"; // public static final String PATTERN_PATH=MODID+":patterns/"; // public static final String TEXTURE_PATH=MODID+":"; // public static final int TICKS_PER_DAY=24000; // public static final int TPS=20; // public static final class Lang{ // private Lang(){} // public static final String RUNE=MODID+".rune"; // public static final String CONFIG=MODID+".configuration"; // public static final String DEC=RUNE+".decorative"; // // public static final class Jei{ // private Jei(){} // public static final String JEI=MODID+".jei"; // public static final String SPIRIT_SWORD=JEI+".spirit_sword"; // public static final String SPIRIT_PICKAXE=JEI+".spirit_pickaxe"; // } // } // } // // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/entity/RuneEntityHealing.java // public class RuneEntityHealing extends RuneEntity { // public RuneEntityHealing(ItemStack[][] actualPattern, EnumFacing facing, // Set<BlockPos> dusts, TileEntityDustActive entity, RuneHealing creator) { // super(actualPattern, facing, dusts, entity, creator); // } // @Override // public void onRuneActivatedbyPlayer(EntityPlayer player, // ItemStack[] sacrifice, boolean negated) { // World world = player.world; // System.out.println("WTF"); // if(!world.isRemote){ // if(!(negated || Utils.takeXP(player, 2))){ // this.onPatternBrokenByPlayer(player); // return; // } // Coords var = ((RuneHealing)creator).getVariableDusts().iterator().next(); // int duration,power,food; // float sat; // switch(EnumDustTypes.getByMeta(placedPattern[var.row][var.col].getMetadata())){ // case PLANT: duration=4;power=1;food=0;sat=0;//gives regen 1 // break; // case GUNPOWDER: duration=5;power=2;food=0;sat=0;//gives regen 2 // break; // case LAPIS: duration=10;power=2;food=5;sat=0.6F; // break; // case BLAZE: duration=32;power=4;food=8;sat=0.8F;//gives regen 4 (regen 5 just gives regen 1) // break; // default: duration=power=0;food=0;sat=0; // break; // } // List<EntityLivingBase> ents = world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPos().add(-3, -1, -3), getPos().add(3,1,3))); // for(EntityLivingBase e:ents){ // e.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, duration*20, power-1)); // if(e instanceof EntityPlayer){ // EntityPlayer p = (EntityPlayer)e; // p.getFoodStats().addStats(food, sat); // } // } // } // } // @Override // public void update() { // if(entity.ticksExisted()>=100){ // this.onPatternBroken(); // } // } // } // Path: src/main/java/xilef11/mc/runesofwizardry_classics/runes/RuneHealing.java import java.io.IOException; import java.util.Set; import com.zpig333.runesofwizardry.api.RuneEntity; import com.zpig333.runesofwizardry.core.rune.PatternUtils; import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xilef11.mc.runesofwizardry_classics.Refs; import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityHealing; /** * */ package xilef11.mc.runesofwizardry_classics.runes; /** * @author Xilef11 * */ public class RuneHealing extends VariableRune { /* (non-Javadoc) * @see xilef11.mc.runesofwizardry_classics.runes.ClassicRune#setupPattern() */ @Override protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(new ResourceLocation(Refs.PATTERN_PATH+"runehealing.json"));
arnohaase/a-foundation
a-foundation/src/main/java/com/ajjpj/afoundation/collection/immutable/ASet.java
// Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/AFunction1.java // public interface AFunction1<P, R, E extends Throwable> extends Serializable { // R apply(P param) throws E; // } // // Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/APartialFunction.java // public interface APartialFunction<P, R, E extends Throwable> extends AFunction1<P, R, E> { // boolean isDefinedAt (P param); // } // // Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/APredicate.java // public interface APredicate<T,E extends Throwable> extends Serializable { // boolean apply(T o) throws E; // }
import com.ajjpj.afoundation.collection.AEquality; import com.ajjpj.afoundation.function.AFunction1; import com.ajjpj.afoundation.function.APartialFunction; import com.ajjpj.afoundation.function.APredicate;
package com.ajjpj.afoundation.collection.immutable; /** * This interface represents an immutable set. It inherits most methods from ACollection, but it * prescribes uniqueness semantics.<p> * * Implementations of {@link ACollection#map(com.ajjpj.afoundation.function.AFunction1)} and * {@link ACollection#flatMap(com.ajjpj.afoundation.function.AFunction1)} do <em>not</em> * return instances of {@code ASet}, but rather generic collections without uniqueness guarantees. If {@code ASet} semantics are * required, call {@link ACollection#toSet()} on the results. * * @author arno */ public interface ASet<T> extends ACollection<T> { static <T> ASet<T> empty() { return AHashSet.empty (); } static <T> ASet<T> create (Iterable<T> elements) { return AHashSet.create (elements); }
// Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/AFunction1.java // public interface AFunction1<P, R, E extends Throwable> extends Serializable { // R apply(P param) throws E; // } // // Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/APartialFunction.java // public interface APartialFunction<P, R, E extends Throwable> extends AFunction1<P, R, E> { // boolean isDefinedAt (P param); // } // // Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/APredicate.java // public interface APredicate<T,E extends Throwable> extends Serializable { // boolean apply(T o) throws E; // } // Path: a-foundation/src/main/java/com/ajjpj/afoundation/collection/immutable/ASet.java import com.ajjpj.afoundation.collection.AEquality; import com.ajjpj.afoundation.function.AFunction1; import com.ajjpj.afoundation.function.APartialFunction; import com.ajjpj.afoundation.function.APredicate; package com.ajjpj.afoundation.collection.immutable; /** * This interface represents an immutable set. It inherits most methods from ACollection, but it * prescribes uniqueness semantics.<p> * * Implementations of {@link ACollection#map(com.ajjpj.afoundation.function.AFunction1)} and * {@link ACollection#flatMap(com.ajjpj.afoundation.function.AFunction1)} do <em>not</em> * return instances of {@code ASet}, but rather generic collections without uniqueness guarantees. If {@code ASet} semantics are * required, call {@link ACollection#toSet()} on the results. * * @author arno */ public interface ASet<T> extends ACollection<T> { static <T> ASet<T> empty() { return AHashSet.empty (); } static <T> ASet<T> create (Iterable<T> elements) { return AHashSet.create (elements); }
@Override <E extends Throwable> ASet<T> filter (APredicate<? super T, E> pred) throws E;
arnohaase/a-foundation
a-foundation/src/main/java/com/ajjpj/afoundation/collection/immutable/ASet.java
// Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/AFunction1.java // public interface AFunction1<P, R, E extends Throwable> extends Serializable { // R apply(P param) throws E; // } // // Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/APartialFunction.java // public interface APartialFunction<P, R, E extends Throwable> extends AFunction1<P, R, E> { // boolean isDefinedAt (P param); // } // // Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/APredicate.java // public interface APredicate<T,E extends Throwable> extends Serializable { // boolean apply(T o) throws E; // }
import com.ajjpj.afoundation.collection.AEquality; import com.ajjpj.afoundation.function.AFunction1; import com.ajjpj.afoundation.function.APartialFunction; import com.ajjpj.afoundation.function.APredicate;
package com.ajjpj.afoundation.collection.immutable; /** * This interface represents an immutable set. It inherits most methods from ACollection, but it * prescribes uniqueness semantics.<p> * * Implementations of {@link ACollection#map(com.ajjpj.afoundation.function.AFunction1)} and * {@link ACollection#flatMap(com.ajjpj.afoundation.function.AFunction1)} do <em>not</em> * return instances of {@code ASet}, but rather generic collections without uniqueness guarantees. If {@code ASet} semantics are * required, call {@link ACollection#toSet()} on the results. * * @author arno */ public interface ASet<T> extends ACollection<T> { static <T> ASet<T> empty() { return AHashSet.empty (); } static <T> ASet<T> create (Iterable<T> elements) { return AHashSet.create (elements); } @Override <E extends Throwable> ASet<T> filter (APredicate<? super T, E> pred) throws E; @Override <E extends Throwable> ASet<T> filterNot (APredicate<? super T, E> pred) throws E;
// Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/AFunction1.java // public interface AFunction1<P, R, E extends Throwable> extends Serializable { // R apply(P param) throws E; // } // // Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/APartialFunction.java // public interface APartialFunction<P, R, E extends Throwable> extends AFunction1<P, R, E> { // boolean isDefinedAt (P param); // } // // Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/APredicate.java // public interface APredicate<T,E extends Throwable> extends Serializable { // boolean apply(T o) throws E; // } // Path: a-foundation/src/main/java/com/ajjpj/afoundation/collection/immutable/ASet.java import com.ajjpj.afoundation.collection.AEquality; import com.ajjpj.afoundation.function.AFunction1; import com.ajjpj.afoundation.function.APartialFunction; import com.ajjpj.afoundation.function.APredicate; package com.ajjpj.afoundation.collection.immutable; /** * This interface represents an immutable set. It inherits most methods from ACollection, but it * prescribes uniqueness semantics.<p> * * Implementations of {@link ACollection#map(com.ajjpj.afoundation.function.AFunction1)} and * {@link ACollection#flatMap(com.ajjpj.afoundation.function.AFunction1)} do <em>not</em> * return instances of {@code ASet}, but rather generic collections without uniqueness guarantees. If {@code ASet} semantics are * required, call {@link ACollection#toSet()} on the results. * * @author arno */ public interface ASet<T> extends ACollection<T> { static <T> ASet<T> empty() { return AHashSet.empty (); } static <T> ASet<T> create (Iterable<T> elements) { return AHashSet.create (elements); } @Override <E extends Throwable> ASet<T> filter (APredicate<? super T, E> pred) throws E; @Override <E extends Throwable> ASet<T> filterNot (APredicate<? super T, E> pred) throws E;
@Override <X, E extends Throwable> ASet<X> map(AFunction1<? super T, ? extends X, E> f) throws E;
arnohaase/a-foundation
a-foundation/src/main/java/com/ajjpj/afoundation/collection/immutable/ASet.java
// Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/AFunction1.java // public interface AFunction1<P, R, E extends Throwable> extends Serializable { // R apply(P param) throws E; // } // // Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/APartialFunction.java // public interface APartialFunction<P, R, E extends Throwable> extends AFunction1<P, R, E> { // boolean isDefinedAt (P param); // } // // Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/APredicate.java // public interface APredicate<T,E extends Throwable> extends Serializable { // boolean apply(T o) throws E; // }
import com.ajjpj.afoundation.collection.AEquality; import com.ajjpj.afoundation.function.AFunction1; import com.ajjpj.afoundation.function.APartialFunction; import com.ajjpj.afoundation.function.APredicate;
package com.ajjpj.afoundation.collection.immutable; /** * This interface represents an immutable set. It inherits most methods from ACollection, but it * prescribes uniqueness semantics.<p> * * Implementations of {@link ACollection#map(com.ajjpj.afoundation.function.AFunction1)} and * {@link ACollection#flatMap(com.ajjpj.afoundation.function.AFunction1)} do <em>not</em> * return instances of {@code ASet}, but rather generic collections without uniqueness guarantees. If {@code ASet} semantics are * required, call {@link ACollection#toSet()} on the results. * * @author arno */ public interface ASet<T> extends ACollection<T> { static <T> ASet<T> empty() { return AHashSet.empty (); } static <T> ASet<T> create (Iterable<T> elements) { return AHashSet.create (elements); } @Override <E extends Throwable> ASet<T> filter (APredicate<? super T, E> pred) throws E; @Override <E extends Throwable> ASet<T> filterNot (APredicate<? super T, E> pred) throws E; @Override <X, E extends Throwable> ASet<X> map(AFunction1<? super T, ? extends X, E> f) throws E; @Override <X, E extends Throwable> ASet<X> flatMap(AFunction1<? super T, ? extends Iterable<X>, E> f) throws E;
// Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/AFunction1.java // public interface AFunction1<P, R, E extends Throwable> extends Serializable { // R apply(P param) throws E; // } // // Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/APartialFunction.java // public interface APartialFunction<P, R, E extends Throwable> extends AFunction1<P, R, E> { // boolean isDefinedAt (P param); // } // // Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/APredicate.java // public interface APredicate<T,E extends Throwable> extends Serializable { // boolean apply(T o) throws E; // } // Path: a-foundation/src/main/java/com/ajjpj/afoundation/collection/immutable/ASet.java import com.ajjpj.afoundation.collection.AEquality; import com.ajjpj.afoundation.function.AFunction1; import com.ajjpj.afoundation.function.APartialFunction; import com.ajjpj.afoundation.function.APredicate; package com.ajjpj.afoundation.collection.immutable; /** * This interface represents an immutable set. It inherits most methods from ACollection, but it * prescribes uniqueness semantics.<p> * * Implementations of {@link ACollection#map(com.ajjpj.afoundation.function.AFunction1)} and * {@link ACollection#flatMap(com.ajjpj.afoundation.function.AFunction1)} do <em>not</em> * return instances of {@code ASet}, but rather generic collections without uniqueness guarantees. If {@code ASet} semantics are * required, call {@link ACollection#toSet()} on the results. * * @author arno */ public interface ASet<T> extends ACollection<T> { static <T> ASet<T> empty() { return AHashSet.empty (); } static <T> ASet<T> create (Iterable<T> elements) { return AHashSet.create (elements); } @Override <E extends Throwable> ASet<T> filter (APredicate<? super T, E> pred) throws E; @Override <E extends Throwable> ASet<T> filterNot (APredicate<? super T, E> pred) throws E; @Override <X, E extends Throwable> ASet<X> map(AFunction1<? super T, ? extends X, E> f) throws E; @Override <X, E extends Throwable> ASet<X> flatMap(AFunction1<? super T, ? extends Iterable<X>, E> f) throws E;
@Override <X, E extends Throwable> ASet<X> collect (APartialFunction<? super T, ? extends X, E> pf) throws E;
arnohaase/a-foundation
a-foundation-benchmark/src/main/java/com/ajjpj/afoundation/concurrent/jdk/ThreadLocalRandomHelper.java
// Path: a-foundation/src/main/java/com/ajjpj/afoundation/util/AUnchecker.java // public class AUnchecker { // public static void throwUnchecked(Throwable th) { // AUnchecker.<RuntimeException> doIt(th); // } // // @SuppressWarnings("unchecked") // private static <T extends Throwable> void doIt(Throwable th) throws T { // throw (T) th; // } // // @SuppressWarnings("unused") // public static void executeUnchecked(AStatement0<? extends Throwable> callback) { // try { // callback.apply(); // } // catch (Throwable exc) { // throwUnchecked (exc); // } // } // // public static <R> R executeUnchecked(AFunction0<R, ? extends Throwable> callback) { // try { // return callback.apply(); // } // catch (Throwable exc) { // throwUnchecked (exc); // return null; //for the compiler // } // } // }
import com.ajjpj.afoundation.util.AUnchecker; import sun.misc.Unsafe; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.concurrent.ThreadLocalRandom;
package com.ajjpj.afoundation.concurrent.jdk; /** * This class bridges package visibility for ThreadLocalRandom methods * * @author arno */ public class ThreadLocalRandomHelper { public static int nextSecondarySeed() { int r; Thread t = Thread.currentThread(); if ((r = UNSAFE.getInt(t, SECONDARY)) != 0) { r ^= r << 13; // xorshift r ^= r >>> 17; r ^= r << 5; } else { localInit(); if ((r = (int)UNSAFE.getLong(t, SEED)) == 0) r = 1; // avoid zero } UNSAFE.putInt(t, SECONDARY, r); return r; } public static void localInit () { try { LOCAL_INIT.invoke (null); } catch (Exception e) {
// Path: a-foundation/src/main/java/com/ajjpj/afoundation/util/AUnchecker.java // public class AUnchecker { // public static void throwUnchecked(Throwable th) { // AUnchecker.<RuntimeException> doIt(th); // } // // @SuppressWarnings("unchecked") // private static <T extends Throwable> void doIt(Throwable th) throws T { // throw (T) th; // } // // @SuppressWarnings("unused") // public static void executeUnchecked(AStatement0<? extends Throwable> callback) { // try { // callback.apply(); // } // catch (Throwable exc) { // throwUnchecked (exc); // } // } // // public static <R> R executeUnchecked(AFunction0<R, ? extends Throwable> callback) { // try { // return callback.apply(); // } // catch (Throwable exc) { // throwUnchecked (exc); // return null; //for the compiler // } // } // } // Path: a-foundation-benchmark/src/main/java/com/ajjpj/afoundation/concurrent/jdk/ThreadLocalRandomHelper.java import com.ajjpj.afoundation.util.AUnchecker; import sun.misc.Unsafe; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.concurrent.ThreadLocalRandom; package com.ajjpj.afoundation.concurrent.jdk; /** * This class bridges package visibility for ThreadLocalRandom methods * * @author arno */ public class ThreadLocalRandomHelper { public static int nextSecondarySeed() { int r; Thread t = Thread.currentThread(); if ((r = UNSAFE.getInt(t, SECONDARY)) != 0) { r ^= r << 13; // xorshift r ^= r >>> 17; r ^= r << 5; } else { localInit(); if ((r = (int)UNSAFE.getLong(t, SEED)) == 0) r = 1; // avoid zero } UNSAFE.putInt(t, SECONDARY, r); return r; } public static void localInit () { try { LOCAL_INIT.invoke (null); } catch (Exception e) {
AUnchecker.throwUnchecked (e);
arnohaase/a-foundation
a-foundation/src/main/java/com/ajjpj/afoundation/collection/immutable/AHashMap.java
// Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/AFunction1.java // public interface AFunction1<P, R, E extends Throwable> extends Serializable { // R apply(P param) throws E; // }
import com.ajjpj.afoundation.collection.AEquality; import com.ajjpj.afoundation.function.AFunction1; import java.util.ArrayDeque; import java.util.Deque; import java.util.Iterator; import java.util.Map;
* and 'values' collections. Both collections are iterated exactly once, and are expected to have the same size. */ public static <K,V> AHashMap<K,V> fromKeysAndValues(Iterable<K> keys, Iterable<V> values) { return fromKeysAndValues(DEFAULT_EQUALITY, keys, values); } /** * Returns an AHashMap instance with a given equalityForEquals, initializing it from separate 'keys' * and 'values' collections. Both collections are iterated exactly once, and are expected to have the same size. */ public static <K,V> AHashMap<K,V> fromKeysAndValues(AEquality equality, Iterable<K> keys, Iterable<V> values) { final Iterator<K> ki = keys.iterator(); final Iterator<V> vi = values.iterator(); AHashMap<K,V> result = empty(equality); while(ki.hasNext()) { final K key = ki.next(); final V value = vi.next(); result = result.updated(key, value); } return result; } /** * Returns an AHashMap instance with default (i.e. equals-based) equalityForEquals, initializing it from a collection of * keys and a function. For each element of the <code>keys</code> collection, the function is called once to * determine the corresponding value, and the pair is then stored in the map. */ @SuppressWarnings("unused")
// Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/AFunction1.java // public interface AFunction1<P, R, E extends Throwable> extends Serializable { // R apply(P param) throws E; // } // Path: a-foundation/src/main/java/com/ajjpj/afoundation/collection/immutable/AHashMap.java import com.ajjpj.afoundation.collection.AEquality; import com.ajjpj.afoundation.function.AFunction1; import java.util.ArrayDeque; import java.util.Deque; import java.util.Iterator; import java.util.Map; * and 'values' collections. Both collections are iterated exactly once, and are expected to have the same size. */ public static <K,V> AHashMap<K,V> fromKeysAndValues(Iterable<K> keys, Iterable<V> values) { return fromKeysAndValues(DEFAULT_EQUALITY, keys, values); } /** * Returns an AHashMap instance with a given equalityForEquals, initializing it from separate 'keys' * and 'values' collections. Both collections are iterated exactly once, and are expected to have the same size. */ public static <K,V> AHashMap<K,V> fromKeysAndValues(AEquality equality, Iterable<K> keys, Iterable<V> values) { final Iterator<K> ki = keys.iterator(); final Iterator<V> vi = values.iterator(); AHashMap<K,V> result = empty(equality); while(ki.hasNext()) { final K key = ki.next(); final V value = vi.next(); result = result.updated(key, value); } return result; } /** * Returns an AHashMap instance with default (i.e. equals-based) equalityForEquals, initializing it from a collection of * keys and a function. For each element of the <code>keys</code> collection, the function is called once to * determine the corresponding value, and the pair is then stored in the map. */ @SuppressWarnings("unused")
public static <K,V, E extends Throwable> AHashMap<K,V> fromKeysAndFunction(Iterable<K> keys, AFunction1<? super K, ? extends V, E> f) throws E {