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
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
// Path: src/main/java/com/github/robocup_atan/atan/model/enums/PlayMode.java // public enum PlayMode { // // /** // * The mode of a game before it starts. // */ // BEFORE_KICK_OFF, // // /** // * The time has finished. // */ // TIME_OVER, // // /** // * The default play mode. // */ // PLAY_ON, // // /** // * We get kick off! // */ // KICK_OFF_OWN, // // /** // * They get kick off. // */ // KICK_OFF_OTHER, // // /** // * We get a kick in. // */ // KICK_IN_OWN, // // /** // * They get a kick in. // */ // KICK_IN_OTHER, // // /** // * We get a free kick. // */ // FREE_KICK_OWN, // // /** // * They get a free kick. // */ // FREE_KICK_OTHER, // // /** // * We commited a free kick fault. // */ // FREE_KICK_FAULT_OWN, // // /** // * They commited a free kick fault. // */ // FREE_KICK_FAULT_OTHER, // // /** // * We get a corner kick. // */ // CORNER_KICK_OWN, // // /** // * They get a corner kick. // */ // CORNER_KICK_OTHER, // // /** // * We get a goal kick. // */ // GOAL_KICK_OWN, // // /** // * They get a goal kick. // */ // GOAL_KICK_OTHER, // // /** // * We scored! // */ // GOAL_OWN, // // /** // * They scored = ( // */ // GOAL_OTHER, // // /** // * Kick off for the left team. // */ // KICK_OFF_L, // // /** // * Kick off for the right team. // */ // KICK_OFF_R, // // /** // * Kick in for the left team. // */ // KICK_IN_L, // // /** // * Kick in for the right team. // */ // KICK_IN_R, // // /** // * Free kick for the right team. // */ // FREE_KICK_R, // // /** // * Free kick for the left team. // */ // FREE_KICK_L, // // /** // * Free kick fault for the left team. // */ // FREE_KICK_FAULT_L, // // /** // * Free kick fault for the left team. // */ // FREE_KICK_FAULT_R, // // /** // * Corner kick for the right team. // */ // CORNER_KICK_R, // // /** // * Corner kick for the left team. // */ // CORNER_KICK_L, // // /** // * Goal kick for the right team. // */ // GOAL_KICK_R, // // /** // * Goal kick for the left team. // */ // GOAL_KICK_L, // // /** // * Right team scored. // */ // GOAL_R, // // /** // * Left team scored. // */ // GOAL_L; // } // // Path: src/main/java/com/github/robocup_atan/atan/model/enums/ViewAngle.java // public enum ViewAngle { // // /** // * A narrow view angle. // */ // NARROW, // // /** // * A normal view angle. // */ // NORMAL, // // /** // * A wide view angle. // */ // WIDE // } // // Path: src/main/java/com/github/robocup_atan/atan/model/enums/ViewQuality.java // public enum ViewQuality { // // /** // * A high view quality. // */ // HIGH, // // /** // * A low view quality. // */ // LOW // }
import com.github.robocup_atan.atan.model.enums.ViewQuality; import java.util.List; import java.util.Vector; import com.github.robocup_atan.atan.model.enums.PlayMode; import com.github.robocup_atan.atan.model.enums.ViewAngle;
buf.append(')'); fifo.add(fifo.size(), buf.toString()); } /** * Goalie special command. Tries to catch the ball in a given direction * relative to its body direction. If the catch is successful the ball will * be in the goalies hand untill kicked away. * * @param direction The direction in which to catch, relative to its body. */ public void addCatchCommand(int direction) { StringBuilder buf = new StringBuilder(); buf.append("(catch "); buf.append(direction); buf.append(')'); fifo.add(fifo.size(), buf.toString()); } /** * Changes the view parameters of the player. The amount and detail returned * by the visual sensor depends on the width of view and the quality. But * note that the frequency of sending information also depends on these * parameters. (eg. If you change the quality from high to low, the * frequency doubles, and the time between the two see sensors will be * cut in half). * * @param angle Between NARROW, NORMAL or WIDE. * @param quality Between HIGH or LOW. */
// Path: src/main/java/com/github/robocup_atan/atan/model/enums/PlayMode.java // public enum PlayMode { // // /** // * The mode of a game before it starts. // */ // BEFORE_KICK_OFF, // // /** // * The time has finished. // */ // TIME_OVER, // // /** // * The default play mode. // */ // PLAY_ON, // // /** // * We get kick off! // */ // KICK_OFF_OWN, // // /** // * They get kick off. // */ // KICK_OFF_OTHER, // // /** // * We get a kick in. // */ // KICK_IN_OWN, // // /** // * They get a kick in. // */ // KICK_IN_OTHER, // // /** // * We get a free kick. // */ // FREE_KICK_OWN, // // /** // * They get a free kick. // */ // FREE_KICK_OTHER, // // /** // * We commited a free kick fault. // */ // FREE_KICK_FAULT_OWN, // // /** // * They commited a free kick fault. // */ // FREE_KICK_FAULT_OTHER, // // /** // * We get a corner kick. // */ // CORNER_KICK_OWN, // // /** // * They get a corner kick. // */ // CORNER_KICK_OTHER, // // /** // * We get a goal kick. // */ // GOAL_KICK_OWN, // // /** // * They get a goal kick. // */ // GOAL_KICK_OTHER, // // /** // * We scored! // */ // GOAL_OWN, // // /** // * They scored = ( // */ // GOAL_OTHER, // // /** // * Kick off for the left team. // */ // KICK_OFF_L, // // /** // * Kick off for the right team. // */ // KICK_OFF_R, // // /** // * Kick in for the left team. // */ // KICK_IN_L, // // /** // * Kick in for the right team. // */ // KICK_IN_R, // // /** // * Free kick for the right team. // */ // FREE_KICK_R, // // /** // * Free kick for the left team. // */ // FREE_KICK_L, // // /** // * Free kick fault for the left team. // */ // FREE_KICK_FAULT_L, // // /** // * Free kick fault for the left team. // */ // FREE_KICK_FAULT_R, // // /** // * Corner kick for the right team. // */ // CORNER_KICK_R, // // /** // * Corner kick for the left team. // */ // CORNER_KICK_L, // // /** // * Goal kick for the right team. // */ // GOAL_KICK_R, // // /** // * Goal kick for the left team. // */ // GOAL_KICK_L, // // /** // * Right team scored. // */ // GOAL_R, // // /** // * Left team scored. // */ // GOAL_L; // } // // Path: src/main/java/com/github/robocup_atan/atan/model/enums/ViewAngle.java // public enum ViewAngle { // // /** // * A narrow view angle. // */ // NARROW, // // /** // * A normal view angle. // */ // NORMAL, // // /** // * A wide view angle. // */ // WIDE // } // // Path: src/main/java/com/github/robocup_atan/atan/model/enums/ViewQuality.java // public enum ViewQuality { // // /** // * A high view quality. // */ // HIGH, // // /** // * A low view quality. // */ // LOW // } // Path: src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java import com.github.robocup_atan.atan.model.enums.ViewQuality; import java.util.List; import java.util.Vector; import com.github.robocup_atan.atan.model.enums.PlayMode; import com.github.robocup_atan.atan.model.enums.ViewAngle; buf.append(')'); fifo.add(fifo.size(), buf.toString()); } /** * Goalie special command. Tries to catch the ball in a given direction * relative to its body direction. If the catch is successful the ball will * be in the goalies hand untill kicked away. * * @param direction The direction in which to catch, relative to its body. */ public void addCatchCommand(int direction) { StringBuilder buf = new StringBuilder(); buf.append("(catch "); buf.append(direction); buf.append(')'); fifo.add(fifo.size(), buf.toString()); } /** * Changes the view parameters of the player. The amount and detail returned * by the visual sensor depends on the width of view and the quality. But * note that the frequency of sending information also depends on these * parameters. (eg. If you change the quality from high to low, the * frequency doubles, and the time between the two see sensors will be * cut in half). * * @param angle Between NARROW, NORMAL or WIDE. * @param quality Between HIGH or LOW. */
public void addChangeViewCommand(ViewAngle angle, ViewQuality quality) {
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
// Path: src/main/java/com/github/robocup_atan/atan/model/enums/PlayMode.java // public enum PlayMode { // // /** // * The mode of a game before it starts. // */ // BEFORE_KICK_OFF, // // /** // * The time has finished. // */ // TIME_OVER, // // /** // * The default play mode. // */ // PLAY_ON, // // /** // * We get kick off! // */ // KICK_OFF_OWN, // // /** // * They get kick off. // */ // KICK_OFF_OTHER, // // /** // * We get a kick in. // */ // KICK_IN_OWN, // // /** // * They get a kick in. // */ // KICK_IN_OTHER, // // /** // * We get a free kick. // */ // FREE_KICK_OWN, // // /** // * They get a free kick. // */ // FREE_KICK_OTHER, // // /** // * We commited a free kick fault. // */ // FREE_KICK_FAULT_OWN, // // /** // * They commited a free kick fault. // */ // FREE_KICK_FAULT_OTHER, // // /** // * We get a corner kick. // */ // CORNER_KICK_OWN, // // /** // * They get a corner kick. // */ // CORNER_KICK_OTHER, // // /** // * We get a goal kick. // */ // GOAL_KICK_OWN, // // /** // * They get a goal kick. // */ // GOAL_KICK_OTHER, // // /** // * We scored! // */ // GOAL_OWN, // // /** // * They scored = ( // */ // GOAL_OTHER, // // /** // * Kick off for the left team. // */ // KICK_OFF_L, // // /** // * Kick off for the right team. // */ // KICK_OFF_R, // // /** // * Kick in for the left team. // */ // KICK_IN_L, // // /** // * Kick in for the right team. // */ // KICK_IN_R, // // /** // * Free kick for the right team. // */ // FREE_KICK_R, // // /** // * Free kick for the left team. // */ // FREE_KICK_L, // // /** // * Free kick fault for the left team. // */ // FREE_KICK_FAULT_L, // // /** // * Free kick fault for the left team. // */ // FREE_KICK_FAULT_R, // // /** // * Corner kick for the right team. // */ // CORNER_KICK_R, // // /** // * Corner kick for the left team. // */ // CORNER_KICK_L, // // /** // * Goal kick for the right team. // */ // GOAL_KICK_R, // // /** // * Goal kick for the left team. // */ // GOAL_KICK_L, // // /** // * Right team scored. // */ // GOAL_R, // // /** // * Left team scored. // */ // GOAL_L; // } // // Path: src/main/java/com/github/robocup_atan/atan/model/enums/ViewAngle.java // public enum ViewAngle { // // /** // * A narrow view angle. // */ // NARROW, // // /** // * A normal view angle. // */ // NORMAL, // // /** // * A wide view angle. // */ // WIDE // } // // Path: src/main/java/com/github/robocup_atan/atan/model/enums/ViewQuality.java // public enum ViewQuality { // // /** // * A high view quality. // */ // HIGH, // // /** // * A low view quality. // */ // LOW // }
import com.github.robocup_atan.atan.model.enums.ViewQuality; import java.util.List; import java.util.Vector; import com.github.robocup_atan.atan.model.enums.PlayMode; import com.github.robocup_atan.atan.model.enums.ViewAngle;
*/ public void addTurnNeckCommand(int angle) { StringBuilder buf = new StringBuilder(); buf.append("(turn_neck "); buf.append(angle); buf.append(')'); fifo.add(fifo.size(), buf.toString()); } /** * This command broadcasts the message throughout the field. Any player * near enough (specified with audio_cut_dist default 50.0 meters), with * enough hearing capacity will hear the message. * * @param message A valid String to say. */ public void addSayCommand(String message) { StringBuilder buf = new StringBuilder(); buf.append("(say "); buf.append(message); buf.append(')'); fifo.add(fifo.size(), buf.toString()); } /** * Trainer only command. * Changes the play mode of the server. * * @param playMode a {@link com.github.robocup_atan.atan.model.enums.PlayMode} object. */
// Path: src/main/java/com/github/robocup_atan/atan/model/enums/PlayMode.java // public enum PlayMode { // // /** // * The mode of a game before it starts. // */ // BEFORE_KICK_OFF, // // /** // * The time has finished. // */ // TIME_OVER, // // /** // * The default play mode. // */ // PLAY_ON, // // /** // * We get kick off! // */ // KICK_OFF_OWN, // // /** // * They get kick off. // */ // KICK_OFF_OTHER, // // /** // * We get a kick in. // */ // KICK_IN_OWN, // // /** // * They get a kick in. // */ // KICK_IN_OTHER, // // /** // * We get a free kick. // */ // FREE_KICK_OWN, // // /** // * They get a free kick. // */ // FREE_KICK_OTHER, // // /** // * We commited a free kick fault. // */ // FREE_KICK_FAULT_OWN, // // /** // * They commited a free kick fault. // */ // FREE_KICK_FAULT_OTHER, // // /** // * We get a corner kick. // */ // CORNER_KICK_OWN, // // /** // * They get a corner kick. // */ // CORNER_KICK_OTHER, // // /** // * We get a goal kick. // */ // GOAL_KICK_OWN, // // /** // * They get a goal kick. // */ // GOAL_KICK_OTHER, // // /** // * We scored! // */ // GOAL_OWN, // // /** // * They scored = ( // */ // GOAL_OTHER, // // /** // * Kick off for the left team. // */ // KICK_OFF_L, // // /** // * Kick off for the right team. // */ // KICK_OFF_R, // // /** // * Kick in for the left team. // */ // KICK_IN_L, // // /** // * Kick in for the right team. // */ // KICK_IN_R, // // /** // * Free kick for the right team. // */ // FREE_KICK_R, // // /** // * Free kick for the left team. // */ // FREE_KICK_L, // // /** // * Free kick fault for the left team. // */ // FREE_KICK_FAULT_L, // // /** // * Free kick fault for the left team. // */ // FREE_KICK_FAULT_R, // // /** // * Corner kick for the right team. // */ // CORNER_KICK_R, // // /** // * Corner kick for the left team. // */ // CORNER_KICK_L, // // /** // * Goal kick for the right team. // */ // GOAL_KICK_R, // // /** // * Goal kick for the left team. // */ // GOAL_KICK_L, // // /** // * Right team scored. // */ // GOAL_R, // // /** // * Left team scored. // */ // GOAL_L; // } // // Path: src/main/java/com/github/robocup_atan/atan/model/enums/ViewAngle.java // public enum ViewAngle { // // /** // * A narrow view angle. // */ // NARROW, // // /** // * A normal view angle. // */ // NORMAL, // // /** // * A wide view angle. // */ // WIDE // } // // Path: src/main/java/com/github/robocup_atan/atan/model/enums/ViewQuality.java // public enum ViewQuality { // // /** // * A high view quality. // */ // HIGH, // // /** // * A low view quality. // */ // LOW // } // Path: src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java import com.github.robocup_atan.atan.model.enums.ViewQuality; import java.util.List; import java.util.Vector; import com.github.robocup_atan.atan.model.enums.PlayMode; import com.github.robocup_atan.atan.model.enums.ViewAngle; */ public void addTurnNeckCommand(int angle) { StringBuilder buf = new StringBuilder(); buf.append("(turn_neck "); buf.append(angle); buf.append(')'); fifo.add(fifo.size(), buf.toString()); } /** * This command broadcasts the message throughout the field. Any player * near enough (specified with audio_cut_dist default 50.0 meters), with * enough hearing capacity will hear the message. * * @param message A valid String to say. */ public void addSayCommand(String message) { StringBuilder buf = new StringBuilder(); buf.append("(say "); buf.append(message); buf.append(')'); fifo.add(fifo.size(), buf.toString()); } /** * Trainer only command. * Changes the play mode of the server. * * @param playMode a {@link com.github.robocup_atan.atan.model.enums.PlayMode} object. */
public void addChangePlayModeCommand(PlayMode playMode) {
robocup-atan/atan
src/test/java/com/github/robocup_atan/atan/parser/player/PlayerHearOthersTest.java
// Path: src/test/java/com/github/robocup_atan/atan/parser/BaseCommandFilter.java // public class BaseCommandFilter implements CommandFilter { // // public void seeCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void hearCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void senseBodyCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void initCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void errorCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void serverParamCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void playerParamCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void playerTypeCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void changePlayerTypeCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void okCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void warningCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // } // // Path: src/main/java/com/github/robocup_atan/atan/parser/Filter.java // public class Filter { // // private enum CommandWords { // change_player_type, // error, // hear, // init, // ok, // player_param, // player_type, // see, // see_global, // sense_body, // server_param, // warning, // INVALID_COMMAND_WORD // } // // /** // * Works out what type of command has been put into the method. // * // * @param cmd The string of text from SServer. // * @param f An instance of CommandFilter. // */ // public void run(String cmd, CommandFilter f) { // // CommandWords commandWord = null; // // if ( cmd.contains(" ") ) { // try { // commandWord = CommandWords.valueOf(cmd.substring(1, cmd.indexOf(" "))); // } catch (IllegalArgumentException e) { // commandWord = CommandWords.INVALID_COMMAND_WORD; // } // } else { // commandWord = CommandWords.INVALID_COMMAND_WORD; // } // // switch (commandWord) { // case change_player_type: // f.changePlayerTypeCommand(cmd.substring(20, cmd.length() - 1)); // break; // case error: // f.errorCommand(cmd.substring(7, cmd.length() - 1)); // break; // case hear: // f.hearCommand(cmd.substring(6, cmd.length() - 1)); // break; // case init: // f.initCommand(cmd.substring(6, cmd.length() - 1)); // break; // case ok: // f.okCommand(cmd.substring(4, cmd.length() - 1)); // break; // case player_param: // f.playerParamCommand(cmd.substring(14, cmd.length() - 1)); // break; // case player_type: // f.playerTypeCommand(cmd.substring(13, cmd.length() - 1)); // break; // case see: // f.seeCommand(cmd.substring(5, cmd.length() - 1)); // break; // case see_global: // f.seeCommand(cmd.substring(12, cmd.length() - 1)); // break; // case sense_body: // f.senseBodyCommand(cmd.substring(12, cmd.length() - 1)); // break; // case server_param: // f.serverParamCommand(cmd.substring(14, cmd.length() - 1)); // break; // case warning : // f.warningCommand(cmd.substring(9, cmd.length() - 1)); // break; // case INVALID_COMMAND_WORD : // default : // throw new Error("Invalid command received: \"" + cmd + "\""); // } // } // }
import java.util.Collection; import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestWatcher; import org.junit.runner.Description; import org.junit.runner.RunWith; import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized; import com.github.robocup_atan.atan.parser.BaseCommandFilter; import com.github.robocup_atan.atan.parser.Filter; import java.io.StringReader; import java.util.Arrays;
private TestFilter commandFilter; private Filter filter; // Test parameters. private String command; private double expectedDirection; private String expectedMessage; public PlayerHearOthersTest( String command, double direction, String message) { this.command = command; this.expectedDirection = direction; this.expectedMessage = message; } @Before public void setUpTest() throws Exception { parser = new CmdParserPlayer(new StringReader("")); commandFilter = new TestFilter(); filter = new Filter(); } @Test public void parseCommand() { filter.run(command, commandFilter); }
// Path: src/test/java/com/github/robocup_atan/atan/parser/BaseCommandFilter.java // public class BaseCommandFilter implements CommandFilter { // // public void seeCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void hearCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void senseBodyCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void initCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void errorCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void serverParamCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void playerParamCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void playerTypeCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void changePlayerTypeCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void okCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void warningCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // } // // Path: src/main/java/com/github/robocup_atan/atan/parser/Filter.java // public class Filter { // // private enum CommandWords { // change_player_type, // error, // hear, // init, // ok, // player_param, // player_type, // see, // see_global, // sense_body, // server_param, // warning, // INVALID_COMMAND_WORD // } // // /** // * Works out what type of command has been put into the method. // * // * @param cmd The string of text from SServer. // * @param f An instance of CommandFilter. // */ // public void run(String cmd, CommandFilter f) { // // CommandWords commandWord = null; // // if ( cmd.contains(" ") ) { // try { // commandWord = CommandWords.valueOf(cmd.substring(1, cmd.indexOf(" "))); // } catch (IllegalArgumentException e) { // commandWord = CommandWords.INVALID_COMMAND_WORD; // } // } else { // commandWord = CommandWords.INVALID_COMMAND_WORD; // } // // switch (commandWord) { // case change_player_type: // f.changePlayerTypeCommand(cmd.substring(20, cmd.length() - 1)); // break; // case error: // f.errorCommand(cmd.substring(7, cmd.length() - 1)); // break; // case hear: // f.hearCommand(cmd.substring(6, cmd.length() - 1)); // break; // case init: // f.initCommand(cmd.substring(6, cmd.length() - 1)); // break; // case ok: // f.okCommand(cmd.substring(4, cmd.length() - 1)); // break; // case player_param: // f.playerParamCommand(cmd.substring(14, cmd.length() - 1)); // break; // case player_type: // f.playerTypeCommand(cmd.substring(13, cmd.length() - 1)); // break; // case see: // f.seeCommand(cmd.substring(5, cmd.length() - 1)); // break; // case see_global: // f.seeCommand(cmd.substring(12, cmd.length() - 1)); // break; // case sense_body: // f.senseBodyCommand(cmd.substring(12, cmd.length() - 1)); // break; // case server_param: // f.serverParamCommand(cmd.substring(14, cmd.length() - 1)); // break; // case warning : // f.warningCommand(cmd.substring(9, cmd.length() - 1)); // break; // case INVALID_COMMAND_WORD : // default : // throw new Error("Invalid command received: \"" + cmd + "\""); // } // } // } // Path: src/test/java/com/github/robocup_atan/atan/parser/player/PlayerHearOthersTest.java import java.util.Collection; import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestWatcher; import org.junit.runner.Description; import org.junit.runner.RunWith; import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized; import com.github.robocup_atan.atan.parser.BaseCommandFilter; import com.github.robocup_atan.atan.parser.Filter; import java.io.StringReader; import java.util.Arrays; private TestFilter commandFilter; private Filter filter; // Test parameters. private String command; private double expectedDirection; private String expectedMessage; public PlayerHearOthersTest( String command, double direction, String message) { this.command = command; this.expectedDirection = direction; this.expectedMessage = message; } @Before public void setUpTest() throws Exception { parser = new CmdParserPlayer(new StringReader("")); commandFilter = new TestFilter(); filter = new Filter(); } @Test public void parseCommand() { filter.run(command, commandFilter); }
private class TestFilter extends BaseCommandFilter {
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/ActionsPlayer.java
// Path: src/main/java/com/github/robocup_atan/atan/model/enums/ViewAngle.java // public enum ViewAngle { // // /** // * A narrow view angle. // */ // NARROW, // // /** // * A normal view angle. // */ // NORMAL, // // /** // * A wide view angle. // */ // WIDE // } // // Path: src/main/java/com/github/robocup_atan/atan/model/enums/ViewQuality.java // public enum ViewQuality { // // /** // * A high view quality. // */ // HIGH, // // /** // * A low view quality. // */ // LOW // }
import com.github.robocup_atan.atan.model.enums.ViewAngle; import com.github.robocup_atan.atan.model.enums.ViewQuality;
package com.github.robocup_atan.atan.model; /* * #%L * Atan * %% * Copyright (C) 2003 - 2014 Atan * %% * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * #L% */ //~--- non-JDK imports -------------------------------------------------------- /** * Interface for an abstract soccer player. To be used by ControllerPlayer. * * @author Atan */ public interface ActionsPlayer { /** * This command accelerates the player in the direction of its body. * * @param power Power is between minpower (-100) and maxpower (+100). */ public void dash(int power); /** * This command can only be executed before kick off or after a goal. * * @param x X location (between -54 and +54). * @param y Y location (between -32 and +32). */ public void move(int x, int y); /** * This command accelerates the ball with the given power in the given direction. * * @param power Power is between minpower (-100) and maxpower (+100). * @param direction Direction is relative to the body of the player. */ public void kick(int power, double direction); /** * This command broadcasts the message throughout the field. Any player * near enough (specified with audio_cut_dist default 50.0 meters), with * enough hearing capacity will hear the message. * * @param message A valid String to say. */ public void say(String message); /** * This command will turn the players body in degrees relative to their * current direction. * * @param angle Angle to turn (between -180 and +180). */ public void turn(double angle); /** * This command can be sent (and will be executed) each cycle independently, * along with other action commands. The neck will rotate with the given angle * relative to the previous angle. * * @param angle Angle to turn the neck (between minneckang and maxneckang) (-90 to +90) */ public void turnNeck(double angle); /** * Goalie special command. Tries to catch the ball in a given direction * relative to its body direction. If the catch is successful the ball will * be in the goalies hand until kicked away. * * @param direction The direction in which to catch, relative to its body. */ public void catchBall(double direction); /** * Changes the view parameters of the player. The amount and detail returned * by the visual sensor depends on the width of view and the quality. But * note that the frequency of sending information also depends on these * parameters. (eg. If you change the quality from high to low, the * frequency doubles, and the time between the two see sensors will be * cut in half). * * @param angle Between NARROW, NORMAL or WIDE. * @param quality Between HIGH or LOW. */
// Path: src/main/java/com/github/robocup_atan/atan/model/enums/ViewAngle.java // public enum ViewAngle { // // /** // * A narrow view angle. // */ // NARROW, // // /** // * A normal view angle. // */ // NORMAL, // // /** // * A wide view angle. // */ // WIDE // } // // Path: src/main/java/com/github/robocup_atan/atan/model/enums/ViewQuality.java // public enum ViewQuality { // // /** // * A high view quality. // */ // HIGH, // // /** // * A low view quality. // */ // LOW // } // Path: src/main/java/com/github/robocup_atan/atan/model/ActionsPlayer.java import com.github.robocup_atan.atan.model.enums.ViewAngle; import com.github.robocup_atan.atan.model.enums.ViewQuality; package com.github.robocup_atan.atan.model; /* * #%L * Atan * %% * Copyright (C) 2003 - 2014 Atan * %% * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * #L% */ //~--- non-JDK imports -------------------------------------------------------- /** * Interface for an abstract soccer player. To be used by ControllerPlayer. * * @author Atan */ public interface ActionsPlayer { /** * This command accelerates the player in the direction of its body. * * @param power Power is between minpower (-100) and maxpower (+100). */ public void dash(int power); /** * This command can only be executed before kick off or after a goal. * * @param x X location (between -54 and +54). * @param y Y location (between -32 and +32). */ public void move(int x, int y); /** * This command accelerates the ball with the given power in the given direction. * * @param power Power is between minpower (-100) and maxpower (+100). * @param direction Direction is relative to the body of the player. */ public void kick(int power, double direction); /** * This command broadcasts the message throughout the field. Any player * near enough (specified with audio_cut_dist default 50.0 meters), with * enough hearing capacity will hear the message. * * @param message A valid String to say. */ public void say(String message); /** * This command will turn the players body in degrees relative to their * current direction. * * @param angle Angle to turn (between -180 and +180). */ public void turn(double angle); /** * This command can be sent (and will be executed) each cycle independently, * along with other action commands. The neck will rotate with the given angle * relative to the previous angle. * * @param angle Angle to turn the neck (between minneckang and maxneckang) (-90 to +90) */ public void turnNeck(double angle); /** * Goalie special command. Tries to catch the ball in a given direction * relative to its body direction. If the catch is successful the ball will * be in the goalies hand until kicked away. * * @param direction The direction in which to catch, relative to its body. */ public void catchBall(double direction); /** * Changes the view parameters of the player. The amount and detail returned * by the visual sensor depends on the width of view and the quality. But * note that the frequency of sending information also depends on these * parameters. (eg. If you change the quality from high to low, the * frequency doubles, and the time between the two see sensors will be * cut in half). * * @param angle Between NARROW, NORMAL or WIDE. * @param quality Between HIGH or LOW. */
public void changeViewMode(ViewQuality quality, ViewAngle angle);
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/ActionsPlayer.java
// Path: src/main/java/com/github/robocup_atan/atan/model/enums/ViewAngle.java // public enum ViewAngle { // // /** // * A narrow view angle. // */ // NARROW, // // /** // * A normal view angle. // */ // NORMAL, // // /** // * A wide view angle. // */ // WIDE // } // // Path: src/main/java/com/github/robocup_atan/atan/model/enums/ViewQuality.java // public enum ViewQuality { // // /** // * A high view quality. // */ // HIGH, // // /** // * A low view quality. // */ // LOW // }
import com.github.robocup_atan.atan.model.enums.ViewAngle; import com.github.robocup_atan.atan.model.enums.ViewQuality;
package com.github.robocup_atan.atan.model; /* * #%L * Atan * %% * Copyright (C) 2003 - 2014 Atan * %% * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * #L% */ //~--- non-JDK imports -------------------------------------------------------- /** * Interface for an abstract soccer player. To be used by ControllerPlayer. * * @author Atan */ public interface ActionsPlayer { /** * This command accelerates the player in the direction of its body. * * @param power Power is between minpower (-100) and maxpower (+100). */ public void dash(int power); /** * This command can only be executed before kick off or after a goal. * * @param x X location (between -54 and +54). * @param y Y location (between -32 and +32). */ public void move(int x, int y); /** * This command accelerates the ball with the given power in the given direction. * * @param power Power is between minpower (-100) and maxpower (+100). * @param direction Direction is relative to the body of the player. */ public void kick(int power, double direction); /** * This command broadcasts the message throughout the field. Any player * near enough (specified with audio_cut_dist default 50.0 meters), with * enough hearing capacity will hear the message. * * @param message A valid String to say. */ public void say(String message); /** * This command will turn the players body in degrees relative to their * current direction. * * @param angle Angle to turn (between -180 and +180). */ public void turn(double angle); /** * This command can be sent (and will be executed) each cycle independently, * along with other action commands. The neck will rotate with the given angle * relative to the previous angle. * * @param angle Angle to turn the neck (between minneckang and maxneckang) (-90 to +90) */ public void turnNeck(double angle); /** * Goalie special command. Tries to catch the ball in a given direction * relative to its body direction. If the catch is successful the ball will * be in the goalies hand until kicked away. * * @param direction The direction in which to catch, relative to its body. */ public void catchBall(double direction); /** * Changes the view parameters of the player. The amount and detail returned * by the visual sensor depends on the width of view and the quality. But * note that the frequency of sending information also depends on these * parameters. (eg. If you change the quality from high to low, the * frequency doubles, and the time between the two see sensors will be * cut in half). * * @param angle Between NARROW, NORMAL or WIDE. * @param quality Between HIGH or LOW. */
// Path: src/main/java/com/github/robocup_atan/atan/model/enums/ViewAngle.java // public enum ViewAngle { // // /** // * A narrow view angle. // */ // NARROW, // // /** // * A normal view angle. // */ // NORMAL, // // /** // * A wide view angle. // */ // WIDE // } // // Path: src/main/java/com/github/robocup_atan/atan/model/enums/ViewQuality.java // public enum ViewQuality { // // /** // * A high view quality. // */ // HIGH, // // /** // * A low view quality. // */ // LOW // } // Path: src/main/java/com/github/robocup_atan/atan/model/ActionsPlayer.java import com.github.robocup_atan.atan.model.enums.ViewAngle; import com.github.robocup_atan.atan.model.enums.ViewQuality; package com.github.robocup_atan.atan.model; /* * #%L * Atan * %% * Copyright (C) 2003 - 2014 Atan * %% * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * #L% */ //~--- non-JDK imports -------------------------------------------------------- /** * Interface for an abstract soccer player. To be used by ControllerPlayer. * * @author Atan */ public interface ActionsPlayer { /** * This command accelerates the player in the direction of its body. * * @param power Power is between minpower (-100) and maxpower (+100). */ public void dash(int power); /** * This command can only be executed before kick off or after a goal. * * @param x X location (between -54 and +54). * @param y Y location (between -32 and +32). */ public void move(int x, int y); /** * This command accelerates the ball with the given power in the given direction. * * @param power Power is between minpower (-100) and maxpower (+100). * @param direction Direction is relative to the body of the player. */ public void kick(int power, double direction); /** * This command broadcasts the message throughout the field. Any player * near enough (specified with audio_cut_dist default 50.0 meters), with * enough hearing capacity will hear the message. * * @param message A valid String to say. */ public void say(String message); /** * This command will turn the players body in degrees relative to their * current direction. * * @param angle Angle to turn (between -180 and +180). */ public void turn(double angle); /** * This command can be sent (and will be executed) each cycle independently, * along with other action commands. The neck will rotate with the given angle * relative to the previous angle. * * @param angle Angle to turn the neck (between minneckang and maxneckang) (-90 to +90) */ public void turnNeck(double angle); /** * Goalie special command. Tries to catch the ball in a given direction * relative to its body direction. If the catch is successful the ball will * be in the goalies hand until kicked away. * * @param direction The direction in which to catch, relative to its body. */ public void catchBall(double direction); /** * Changes the view parameters of the player. The amount and detail returned * by the visual sensor depends on the width of view and the quality. But * note that the frequency of sending information also depends on these * parameters. (eg. If you change the quality from high to low, the * frequency doubles, and the time between the two see sensors will be * cut in half). * * @param angle Between NARROW, NORMAL or WIDE. * @param quality Between HIGH or LOW. */
public void changeViewMode(ViewQuality quality, ViewAngle angle);
robocup-atan/atan
src/test/java/com/github/robocup_atan/atan/parser/player/PlayerHearSelfTest.java
// Path: src/test/java/com/github/robocup_atan/atan/parser/BaseCommandFilter.java // public class BaseCommandFilter implements CommandFilter { // // public void seeCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void hearCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void senseBodyCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void initCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void errorCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void serverParamCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void playerParamCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void playerTypeCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void changePlayerTypeCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void okCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void warningCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // } // // Path: src/main/java/com/github/robocup_atan/atan/parser/Filter.java // public class Filter { // // private enum CommandWords { // change_player_type, // error, // hear, // init, // ok, // player_param, // player_type, // see, // see_global, // sense_body, // server_param, // warning, // INVALID_COMMAND_WORD // } // // /** // * Works out what type of command has been put into the method. // * // * @param cmd The string of text from SServer. // * @param f An instance of CommandFilter. // */ // public void run(String cmd, CommandFilter f) { // // CommandWords commandWord = null; // // if ( cmd.contains(" ") ) { // try { // commandWord = CommandWords.valueOf(cmd.substring(1, cmd.indexOf(" "))); // } catch (IllegalArgumentException e) { // commandWord = CommandWords.INVALID_COMMAND_WORD; // } // } else { // commandWord = CommandWords.INVALID_COMMAND_WORD; // } // // switch (commandWord) { // case change_player_type: // f.changePlayerTypeCommand(cmd.substring(20, cmd.length() - 1)); // break; // case error: // f.errorCommand(cmd.substring(7, cmd.length() - 1)); // break; // case hear: // f.hearCommand(cmd.substring(6, cmd.length() - 1)); // break; // case init: // f.initCommand(cmd.substring(6, cmd.length() - 1)); // break; // case ok: // f.okCommand(cmd.substring(4, cmd.length() - 1)); // break; // case player_param: // f.playerParamCommand(cmd.substring(14, cmd.length() - 1)); // break; // case player_type: // f.playerTypeCommand(cmd.substring(13, cmd.length() - 1)); // break; // case see: // f.seeCommand(cmd.substring(5, cmd.length() - 1)); // break; // case see_global: // f.seeCommand(cmd.substring(12, cmd.length() - 1)); // break; // case sense_body: // f.senseBodyCommand(cmd.substring(12, cmd.length() - 1)); // break; // case server_param: // f.serverParamCommand(cmd.substring(14, cmd.length() - 1)); // break; // case warning : // f.warningCommand(cmd.substring(9, cmd.length() - 1)); // break; // case INVALID_COMMAND_WORD : // default : // throw new Error("Invalid command received: \"" + cmd + "\""); // } // } // }
import java.util.Collection; import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestWatcher; import org.junit.runner.Description; import org.junit.runner.RunWith; import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized; import com.github.robocup_atan.atan.parser.BaseCommandFilter; import com.github.robocup_atan.atan.parser.Filter; import java.io.StringReader; import java.util.Arrays;
// Global test variables. private CmdParserPlayer parser; private TestFilter commandFilter; private Filter filter; // Test parameters. private String command; private String expectedMessage; public PlayerHearSelfTest( String command, String message) { this.command = command; this.expectedMessage = message; } @Before public void setUpTest() throws Exception { parser = new CmdParserPlayer(new StringReader("")); commandFilter = new TestFilter(); filter = new Filter(); } @Test public void parseCommand() { filter.run(command, commandFilter); }
// Path: src/test/java/com/github/robocup_atan/atan/parser/BaseCommandFilter.java // public class BaseCommandFilter implements CommandFilter { // // public void seeCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void hearCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void senseBodyCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void initCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void errorCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void serverParamCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void playerParamCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void playerTypeCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void changePlayerTypeCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void okCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // // public void warningCommand(String cmd) { // throw new UnsupportedOperationException("Not supported in this test."); // } // } // // Path: src/main/java/com/github/robocup_atan/atan/parser/Filter.java // public class Filter { // // private enum CommandWords { // change_player_type, // error, // hear, // init, // ok, // player_param, // player_type, // see, // see_global, // sense_body, // server_param, // warning, // INVALID_COMMAND_WORD // } // // /** // * Works out what type of command has been put into the method. // * // * @param cmd The string of text from SServer. // * @param f An instance of CommandFilter. // */ // public void run(String cmd, CommandFilter f) { // // CommandWords commandWord = null; // // if ( cmd.contains(" ") ) { // try { // commandWord = CommandWords.valueOf(cmd.substring(1, cmd.indexOf(" "))); // } catch (IllegalArgumentException e) { // commandWord = CommandWords.INVALID_COMMAND_WORD; // } // } else { // commandWord = CommandWords.INVALID_COMMAND_WORD; // } // // switch (commandWord) { // case change_player_type: // f.changePlayerTypeCommand(cmd.substring(20, cmd.length() - 1)); // break; // case error: // f.errorCommand(cmd.substring(7, cmd.length() - 1)); // break; // case hear: // f.hearCommand(cmd.substring(6, cmd.length() - 1)); // break; // case init: // f.initCommand(cmd.substring(6, cmd.length() - 1)); // break; // case ok: // f.okCommand(cmd.substring(4, cmd.length() - 1)); // break; // case player_param: // f.playerParamCommand(cmd.substring(14, cmd.length() - 1)); // break; // case player_type: // f.playerTypeCommand(cmd.substring(13, cmd.length() - 1)); // break; // case see: // f.seeCommand(cmd.substring(5, cmd.length() - 1)); // break; // case see_global: // f.seeCommand(cmd.substring(12, cmd.length() - 1)); // break; // case sense_body: // f.senseBodyCommand(cmd.substring(12, cmd.length() - 1)); // break; // case server_param: // f.serverParamCommand(cmd.substring(14, cmd.length() - 1)); // break; // case warning : // f.warningCommand(cmd.substring(9, cmd.length() - 1)); // break; // case INVALID_COMMAND_WORD : // default : // throw new Error("Invalid command received: \"" + cmd + "\""); // } // } // } // Path: src/test/java/com/github/robocup_atan/atan/parser/player/PlayerHearSelfTest.java import java.util.Collection; import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestWatcher; import org.junit.runner.Description; import org.junit.runner.RunWith; import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized; import com.github.robocup_atan.atan.parser.BaseCommandFilter; import com.github.robocup_atan.atan.parser.Filter; import java.io.StringReader; import java.util.Arrays; // Global test variables. private CmdParserPlayer parser; private TestFilter commandFilter; private Filter filter; // Test parameters. private String command; private String expectedMessage; public PlayerHearSelfTest( String command, String message) { this.command = command; this.expectedMessage = message; } @Before public void setUpTest() throws Exception { parser = new CmdParserPlayer(new StringReader("")); commandFilter = new TestFilter(); filter = new Filter(); } @Test public void parseCommand() { filter.run(command, commandFilter); }
private class TestFilter extends BaseCommandFilter {
zhouruikevin/ImageLoadPK
imageloadpk/src/main/java/com/example/imageloadpk/adapter/adapters/ImageListAdapter.java
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/model/Data.java // public final class Data { // // public static final String BASE = "http://i.imgur.com/"; // public static final String EXT = ".jpg"; // public static final String[] URLS = { // BASE + "CqmBjo5" + EXT, BASE + "zkaAooq" + EXT, BASE + "0gqnEaY" + EXT, // BASE + "9gbQ7YR" + EXT, BASE + "aFhEEby" + EXT, BASE + "0E2tgV7" + EXT, // BASE + "P5JLfjk" + EXT, BASE + "nz67a4F" + EXT, BASE + "dFH34N5" + EXT, // BASE + "FI49ftb" + EXT, BASE + "DvpvklR" + EXT, BASE + "DNKnbG8" + EXT, // BASE + "yAdbrLp" + EXT, BASE + "55w5Km7" + EXT, BASE + "NIwNTMR" + EXT, // BASE + "DAl0KB8" + EXT, BASE + "xZLIYFV" + EXT, BASE + "HvTyeh3" + EXT, // BASE + "Ig9oHCM" + EXT, BASE + "7GUv9qa" + EXT, BASE + "i5vXmXp" + EXT, // BASE + "glyvuXg" + EXT, BASE + "u6JF6JZ" + EXT, BASE + "ExwR7ap" + EXT, // BASE + "Q54zMKT" + EXT, BASE + "9t6hLbm" + EXT, BASE + "F8n3Ic6" + EXT, // BASE + "P5ZRSvT" + EXT, BASE + "jbemFzr" + EXT, BASE + "8B7haIK" + EXT, // BASE + "aSeTYQr" + EXT, BASE + "OKvWoTh" + EXT, BASE + "zD3gT4Z" + EXT, // BASE + "z77CaIt" + EXT, // }; // // private Data() { // // No instances. // } // }
import android.content.Context; import android.support.v7.widget.RecyclerView; import com.example.imageloadpk.adapter.watcher.WatchListener; import com.example.imageloadpk.model.Data; import java.util.ArrayList; import java.util.Collections; import java.util.List;
package com.example.imageloadpk.adapter.adapters; /** * Created by Nevermore on 16/7/2. */ public abstract class ImageListAdapter extends RecyclerView.Adapter { private final Context mContext; private List<String> mDatas;
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/model/Data.java // public final class Data { // // public static final String BASE = "http://i.imgur.com/"; // public static final String EXT = ".jpg"; // public static final String[] URLS = { // BASE + "CqmBjo5" + EXT, BASE + "zkaAooq" + EXT, BASE + "0gqnEaY" + EXT, // BASE + "9gbQ7YR" + EXT, BASE + "aFhEEby" + EXT, BASE + "0E2tgV7" + EXT, // BASE + "P5JLfjk" + EXT, BASE + "nz67a4F" + EXT, BASE + "dFH34N5" + EXT, // BASE + "FI49ftb" + EXT, BASE + "DvpvklR" + EXT, BASE + "DNKnbG8" + EXT, // BASE + "yAdbrLp" + EXT, BASE + "55w5Km7" + EXT, BASE + "NIwNTMR" + EXT, // BASE + "DAl0KB8" + EXT, BASE + "xZLIYFV" + EXT, BASE + "HvTyeh3" + EXT, // BASE + "Ig9oHCM" + EXT, BASE + "7GUv9qa" + EXT, BASE + "i5vXmXp" + EXT, // BASE + "glyvuXg" + EXT, BASE + "u6JF6JZ" + EXT, BASE + "ExwR7ap" + EXT, // BASE + "Q54zMKT" + EXT, BASE + "9t6hLbm" + EXT, BASE + "F8n3Ic6" + EXT, // BASE + "P5ZRSvT" + EXT, BASE + "jbemFzr" + EXT, BASE + "8B7haIK" + EXT, // BASE + "aSeTYQr" + EXT, BASE + "OKvWoTh" + EXT, BASE + "zD3gT4Z" + EXT, // BASE + "z77CaIt" + EXT, // }; // // private Data() { // // No instances. // } // } // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/adapters/ImageListAdapter.java import android.content.Context; import android.support.v7.widget.RecyclerView; import com.example.imageloadpk.adapter.watcher.WatchListener; import com.example.imageloadpk.model.Data; import java.util.ArrayList; import java.util.Collections; import java.util.List; package com.example.imageloadpk.adapter.adapters; /** * Created by Nevermore on 16/7/2. */ public abstract class ImageListAdapter extends RecyclerView.Adapter { private final Context mContext; private List<String> mDatas;
private final WatchListener mWatchListener;
zhouruikevin/ImageLoadPK
imageloadpk/src/main/java/com/example/imageloadpk/adapter/adapters/ImageListAdapter.java
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/model/Data.java // public final class Data { // // public static final String BASE = "http://i.imgur.com/"; // public static final String EXT = ".jpg"; // public static final String[] URLS = { // BASE + "CqmBjo5" + EXT, BASE + "zkaAooq" + EXT, BASE + "0gqnEaY" + EXT, // BASE + "9gbQ7YR" + EXT, BASE + "aFhEEby" + EXT, BASE + "0E2tgV7" + EXT, // BASE + "P5JLfjk" + EXT, BASE + "nz67a4F" + EXT, BASE + "dFH34N5" + EXT, // BASE + "FI49ftb" + EXT, BASE + "DvpvklR" + EXT, BASE + "DNKnbG8" + EXT, // BASE + "yAdbrLp" + EXT, BASE + "55w5Km7" + EXT, BASE + "NIwNTMR" + EXT, // BASE + "DAl0KB8" + EXT, BASE + "xZLIYFV" + EXT, BASE + "HvTyeh3" + EXT, // BASE + "Ig9oHCM" + EXT, BASE + "7GUv9qa" + EXT, BASE + "i5vXmXp" + EXT, // BASE + "glyvuXg" + EXT, BASE + "u6JF6JZ" + EXT, BASE + "ExwR7ap" + EXT, // BASE + "Q54zMKT" + EXT, BASE + "9t6hLbm" + EXT, BASE + "F8n3Ic6" + EXT, // BASE + "P5ZRSvT" + EXT, BASE + "jbemFzr" + EXT, BASE + "8B7haIK" + EXT, // BASE + "aSeTYQr" + EXT, BASE + "OKvWoTh" + EXT, BASE + "zD3gT4Z" + EXT, // BASE + "z77CaIt" + EXT, // }; // // private Data() { // // No instances. // } // }
import android.content.Context; import android.support.v7.widget.RecyclerView; import com.example.imageloadpk.adapter.watcher.WatchListener; import com.example.imageloadpk.model.Data; import java.util.ArrayList; import java.util.Collections; import java.util.List;
package com.example.imageloadpk.adapter.adapters; /** * Created by Nevermore on 16/7/2. */ public abstract class ImageListAdapter extends RecyclerView.Adapter { private final Context mContext; private List<String> mDatas; private final WatchListener mWatchListener; public ImageListAdapter(Context context, WatchListener watchListener) { mContext = context; mWatchListener = watchListener; mDatas = new ArrayList<>(); } protected void addUrl(String url) { mDatas.add(url); } public void setDatas() {
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/model/Data.java // public final class Data { // // public static final String BASE = "http://i.imgur.com/"; // public static final String EXT = ".jpg"; // public static final String[] URLS = { // BASE + "CqmBjo5" + EXT, BASE + "zkaAooq" + EXT, BASE + "0gqnEaY" + EXT, // BASE + "9gbQ7YR" + EXT, BASE + "aFhEEby" + EXT, BASE + "0E2tgV7" + EXT, // BASE + "P5JLfjk" + EXT, BASE + "nz67a4F" + EXT, BASE + "dFH34N5" + EXT, // BASE + "FI49ftb" + EXT, BASE + "DvpvklR" + EXT, BASE + "DNKnbG8" + EXT, // BASE + "yAdbrLp" + EXT, BASE + "55w5Km7" + EXT, BASE + "NIwNTMR" + EXT, // BASE + "DAl0KB8" + EXT, BASE + "xZLIYFV" + EXT, BASE + "HvTyeh3" + EXT, // BASE + "Ig9oHCM" + EXT, BASE + "7GUv9qa" + EXT, BASE + "i5vXmXp" + EXT, // BASE + "glyvuXg" + EXT, BASE + "u6JF6JZ" + EXT, BASE + "ExwR7ap" + EXT, // BASE + "Q54zMKT" + EXT, BASE + "9t6hLbm" + EXT, BASE + "F8n3Ic6" + EXT, // BASE + "P5ZRSvT" + EXT, BASE + "jbemFzr" + EXT, BASE + "8B7haIK" + EXT, // BASE + "aSeTYQr" + EXT, BASE + "OKvWoTh" + EXT, BASE + "zD3gT4Z" + EXT, // BASE + "z77CaIt" + EXT, // }; // // private Data() { // // No instances. // } // } // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/adapters/ImageListAdapter.java import android.content.Context; import android.support.v7.widget.RecyclerView; import com.example.imageloadpk.adapter.watcher.WatchListener; import com.example.imageloadpk.model.Data; import java.util.ArrayList; import java.util.Collections; import java.util.List; package com.example.imageloadpk.adapter.adapters; /** * Created by Nevermore on 16/7/2. */ public abstract class ImageListAdapter extends RecyclerView.Adapter { private final Context mContext; private List<String> mDatas; private final WatchListener mWatchListener; public ImageListAdapter(Context context, WatchListener watchListener) { mContext = context; mWatchListener = watchListener; mDatas = new ArrayList<>(); } protected void addUrl(String url) { mDatas.add(url); } public void setDatas() {
Collections.addAll(mDatas, Data.URLS);
zhouruikevin/ImageLoadPK
imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/PicassoHolder.java
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/Drawables.java // public class Drawables { // public static Drawable sPlaceholderDrawable; // public static Drawable sErrorDrawable; // // private Drawables() { // } // // public static void init(final Resources resources) { // if (sPlaceholderDrawable == null) { // sPlaceholderDrawable = resources.getDrawable(R.drawable.placeholder, null); // } // if (sErrorDrawable == null) { // sErrorDrawable = resources.getDrawable(R.drawable.error, null); // } // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // }
import android.content.Context; import android.view.View; import android.widget.ImageView; import com.example.imageloadpk.adapter.watcher.Drawables; import com.example.imageloadpk.adapter.watcher.WatchListener; import com.squareup.picasso.Picasso;
package com.example.imageloadpk.adapter.holders; /** * Created by Administrator on 2016/7/4. */ public class PicassoHolder extends BaseHolder { private final Picasso mPicasso;
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/Drawables.java // public class Drawables { // public static Drawable sPlaceholderDrawable; // public static Drawable sErrorDrawable; // // private Drawables() { // } // // public static void init(final Resources resources) { // if (sPlaceholderDrawable == null) { // sPlaceholderDrawable = resources.getDrawable(R.drawable.placeholder, null); // } // if (sErrorDrawable == null) { // sErrorDrawable = resources.getDrawable(R.drawable.error, null); // } // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // } // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/PicassoHolder.java import android.content.Context; import android.view.View; import android.widget.ImageView; import com.example.imageloadpk.adapter.watcher.Drawables; import com.example.imageloadpk.adapter.watcher.WatchListener; import com.squareup.picasso.Picasso; package com.example.imageloadpk.adapter.holders; /** * Created by Administrator on 2016/7/4. */ public class PicassoHolder extends BaseHolder { private final Picasso mPicasso;
public PicassoHolder(ImageView imageView, WatchListener watchListener, View parentView, Context context, Picasso picasso) {
zhouruikevin/ImageLoadPK
imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/PicassoHolder.java
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/Drawables.java // public class Drawables { // public static Drawable sPlaceholderDrawable; // public static Drawable sErrorDrawable; // // private Drawables() { // } // // public static void init(final Resources resources) { // if (sPlaceholderDrawable == null) { // sPlaceholderDrawable = resources.getDrawable(R.drawable.placeholder, null); // } // if (sErrorDrawable == null) { // sErrorDrawable = resources.getDrawable(R.drawable.error, null); // } // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // }
import android.content.Context; import android.view.View; import android.widget.ImageView; import com.example.imageloadpk.adapter.watcher.Drawables; import com.example.imageloadpk.adapter.watcher.WatchListener; import com.squareup.picasso.Picasso;
package com.example.imageloadpk.adapter.holders; /** * Created by Administrator on 2016/7/4. */ public class PicassoHolder extends BaseHolder { private final Picasso mPicasso; public PicassoHolder(ImageView imageView, WatchListener watchListener, View parentView, Context context, Picasso picasso) { super(imageView, watchListener, parentView, context); mPicasso = picasso; } @Override protected void onBind(String url) { mPicasso.load(url)
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/Drawables.java // public class Drawables { // public static Drawable sPlaceholderDrawable; // public static Drawable sErrorDrawable; // // private Drawables() { // } // // public static void init(final Resources resources) { // if (sPlaceholderDrawable == null) { // sPlaceholderDrawable = resources.getDrawable(R.drawable.placeholder, null); // } // if (sErrorDrawable == null) { // sErrorDrawable = resources.getDrawable(R.drawable.error, null); // } // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // } // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/PicassoHolder.java import android.content.Context; import android.view.View; import android.widget.ImageView; import com.example.imageloadpk.adapter.watcher.Drawables; import com.example.imageloadpk.adapter.watcher.WatchListener; import com.squareup.picasso.Picasso; package com.example.imageloadpk.adapter.holders; /** * Created by Administrator on 2016/7/4. */ public class PicassoHolder extends BaseHolder { private final Picasso mPicasso; public PicassoHolder(ImageView imageView, WatchListener watchListener, View parentView, Context context, Picasso picasso) { super(imageView, watchListener, parentView, context); mPicasso = picasso; } @Override protected void onBind(String url) { mPicasso.load(url)
.placeholder(Drawables.sPlaceholderDrawable)
zhouruikevin/ImageLoadPK
imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/GlideHolder.java
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/Drawables.java // public class Drawables { // public static Drawable sPlaceholderDrawable; // public static Drawable sErrorDrawable; // // private Drawables() { // } // // public static void init(final Resources resources) { // if (sPlaceholderDrawable == null) { // sPlaceholderDrawable = resources.getDrawable(R.drawable.placeholder, null); // } // if (sErrorDrawable == null) { // sErrorDrawable = resources.getDrawable(R.drawable.error, null); // } // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchImageView.java // public class WatchImageView extends ImageView implements WatchInterface { // private final WatchImpl mWatcher; // // public WatchImageView(Context context) { // super(context); // //设置图片填充样式为按比例填满控件 // setScaleType(ScaleType.CENTER_CROP); // mWatcher = new WatchImpl(this); // } // // // @Override // protected void onDraw(Canvas canvas) { // super.onDraw(canvas); // //绘制结果会用到,通过mWatcher转发 // mWatcher.onDraw(canvas); // } // // // 禁用这个方法,防止框架使用它显示图片,影响我们测试显示 // @Override // public void setImageURI(Uri uri) { // throw new UnsupportedOperationException(); // } // // @Override // public void initWatcher(String tag, WatchListener watchListener) { // mWatcher.init(tag, watchListener); // mWatcher.onStart(); //初始化 // } // // @Override // public void setImageDrawable(Drawable drawable) { // // Preconditions.checkNotNull(drawable); // if (drawable == Drawables.sPlaceholderDrawable) { // //不再这里调用,在初始化加载器,Glide.build()实现调用更好 // } else if (drawable == Drawables.sErrorDrawable) { // mWatcher.onFailure();//加载失败 // } else { // mWatcher.onSuccess();//加载成功 // } // super.setImageDrawable(drawable); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // }
import android.content.Context; import android.util.Log; import android.view.View; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.resource.drawable.GlideDrawable; import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.target.Target; import com.example.imageloadpk.adapter.watcher.Drawables; import com.example.imageloadpk.adapter.watcher.WatchImageView; import com.example.imageloadpk.adapter.watcher.WatchListener;
package com.example.imageloadpk.adapter.holders; /** * Created by Nevermore on 16/7/3. */ public class GlideHolder extends BaseHolder<WatchImageView> { public GlideHolder(WatchImageView imageView, WatchListener watchListener, View parentView, Context context) { super(imageView, watchListener, parentView, context); } public final static String TAG = "GlideHolder"; private RequestListener<String, GlideDrawable> mRequestListener = new RequestListener<String, GlideDrawable>() { @Override public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) { Log.w(TAG, "onException: ", e); Log.d(TAG, "onException: " + model); Log.d(TAG, "onException: " + target.getRequest().isRunning()); return false; } @Override public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) { return false; } }; @Override protected void onBind(String url) { Glide.with(getContext()) .load(url) .listener(mRequestListener)//配置监听器
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/Drawables.java // public class Drawables { // public static Drawable sPlaceholderDrawable; // public static Drawable sErrorDrawable; // // private Drawables() { // } // // public static void init(final Resources resources) { // if (sPlaceholderDrawable == null) { // sPlaceholderDrawable = resources.getDrawable(R.drawable.placeholder, null); // } // if (sErrorDrawable == null) { // sErrorDrawable = resources.getDrawable(R.drawable.error, null); // } // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchImageView.java // public class WatchImageView extends ImageView implements WatchInterface { // private final WatchImpl mWatcher; // // public WatchImageView(Context context) { // super(context); // //设置图片填充样式为按比例填满控件 // setScaleType(ScaleType.CENTER_CROP); // mWatcher = new WatchImpl(this); // } // // // @Override // protected void onDraw(Canvas canvas) { // super.onDraw(canvas); // //绘制结果会用到,通过mWatcher转发 // mWatcher.onDraw(canvas); // } // // // 禁用这个方法,防止框架使用它显示图片,影响我们测试显示 // @Override // public void setImageURI(Uri uri) { // throw new UnsupportedOperationException(); // } // // @Override // public void initWatcher(String tag, WatchListener watchListener) { // mWatcher.init(tag, watchListener); // mWatcher.onStart(); //初始化 // } // // @Override // public void setImageDrawable(Drawable drawable) { // // Preconditions.checkNotNull(drawable); // if (drawable == Drawables.sPlaceholderDrawable) { // //不再这里调用,在初始化加载器,Glide.build()实现调用更好 // } else if (drawable == Drawables.sErrorDrawable) { // mWatcher.onFailure();//加载失败 // } else { // mWatcher.onSuccess();//加载成功 // } // super.setImageDrawable(drawable); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // } // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/GlideHolder.java import android.content.Context; import android.util.Log; import android.view.View; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.resource.drawable.GlideDrawable; import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.target.Target; import com.example.imageloadpk.adapter.watcher.Drawables; import com.example.imageloadpk.adapter.watcher.WatchImageView; import com.example.imageloadpk.adapter.watcher.WatchListener; package com.example.imageloadpk.adapter.holders; /** * Created by Nevermore on 16/7/3. */ public class GlideHolder extends BaseHolder<WatchImageView> { public GlideHolder(WatchImageView imageView, WatchListener watchListener, View parentView, Context context) { super(imageView, watchListener, parentView, context); } public final static String TAG = "GlideHolder"; private RequestListener<String, GlideDrawable> mRequestListener = new RequestListener<String, GlideDrawable>() { @Override public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) { Log.w(TAG, "onException: ", e); Log.d(TAG, "onException: " + model); Log.d(TAG, "onException: " + target.getRequest().isRunning()); return false; } @Override public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) { return false; } }; @Override protected void onBind(String url) { Glide.with(getContext()) .load(url) .listener(mRequestListener)//配置监听器
.placeholder(Drawables.sPlaceholderDrawable)
zhouruikevin/ImageLoadPK
glidesample/src/main/java/example/com/glidesample/ui/SimpleActivity.java
// Path: glidesample/src/main/java/example/com/glidesample/model/Url.java // public interface Url { // String IMAGE_URL_TROCHILIDAE = "http://o9xuvf3m3.bkt.clouddn.com/trochilidae.jpg"; // String IMAGE_URL_NEW_YORK = "http://o9xuvf3m3.bkt.clouddn.com/new_york.jpg"; // String IMAGE_URL_PERU = "http://o9xuvf3m3.bkt.clouddn.com/peru.jpg"; // String IMAGE_URL_FRANCE_1 = "http://o9xuvf3m3.bkt.clouddn.com/france-217.jpg"; // String IMAGE_URL_FRANCE_2 = "http://o9xuvf3m3.bkt.clouddn.com/france-220.jpg"; // String IMAGE_URL_FRANCE_3 = "http://o9xuvf3m3.bkt.clouddn.com/france-216.jpg"; // String IMAGE_URL_FRANCE_4 = "http://o9xuvf3m3.bkt.clouddn.com/france-221.jpg"; // // }
import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.view.animation.AnimationUtils; import android.widget.Button; import android.widget.ImageView; import android.widget.ProgressBar; import com.bumptech.glide.DrawableRequestBuilder; import com.bumptech.glide.Glide; import com.bumptech.glide.Priority; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.resource.bitmap.GlideBitmapDrawable; import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.animation.GlideAnimation; import com.bumptech.glide.request.target.SimpleTarget; import com.bumptech.glide.request.target.Target; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; import example.com.glidesample.R; import example.com.glidesample.model.Url;
@Bind(R.id.btnFade) Button mBtnFade; @Bind(R.id.btnLeft) Button mBtnLeft; @Bind(R.id.btnScale) Button mBtnScale; @Bind(R.id.btnAllAnimate) Button mBtnAllAnimate; @Bind(R.id.btnPriority) Button mBtnPriority; @Bind(R.id.btnDownLoad) Button mBtnDownLoad; @Bind(R.id.btnBackground) Button mBtnBackground; @Bind(R.id.ivTonLeft) ImageView mIvTonLeft; @Bind(R.id.ivTonyRight) ImageView mIvTonyRight; private Context mContext; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_simple); ButterKnife.bind(this); mContext = this; } private DrawableRequestBuilder getCommGlide() { return Glide.with(mContext)
// Path: glidesample/src/main/java/example/com/glidesample/model/Url.java // public interface Url { // String IMAGE_URL_TROCHILIDAE = "http://o9xuvf3m3.bkt.clouddn.com/trochilidae.jpg"; // String IMAGE_URL_NEW_YORK = "http://o9xuvf3m3.bkt.clouddn.com/new_york.jpg"; // String IMAGE_URL_PERU = "http://o9xuvf3m3.bkt.clouddn.com/peru.jpg"; // String IMAGE_URL_FRANCE_1 = "http://o9xuvf3m3.bkt.clouddn.com/france-217.jpg"; // String IMAGE_URL_FRANCE_2 = "http://o9xuvf3m3.bkt.clouddn.com/france-220.jpg"; // String IMAGE_URL_FRANCE_3 = "http://o9xuvf3m3.bkt.clouddn.com/france-216.jpg"; // String IMAGE_URL_FRANCE_4 = "http://o9xuvf3m3.bkt.clouddn.com/france-221.jpg"; // // } // Path: glidesample/src/main/java/example/com/glidesample/ui/SimpleActivity.java import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.view.animation.AnimationUtils; import android.widget.Button; import android.widget.ImageView; import android.widget.ProgressBar; import com.bumptech.glide.DrawableRequestBuilder; import com.bumptech.glide.Glide; import com.bumptech.glide.Priority; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.resource.bitmap.GlideBitmapDrawable; import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.animation.GlideAnimation; import com.bumptech.glide.request.target.SimpleTarget; import com.bumptech.glide.request.target.Target; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; import example.com.glidesample.R; import example.com.glidesample.model.Url; @Bind(R.id.btnFade) Button mBtnFade; @Bind(R.id.btnLeft) Button mBtnLeft; @Bind(R.id.btnScale) Button mBtnScale; @Bind(R.id.btnAllAnimate) Button mBtnAllAnimate; @Bind(R.id.btnPriority) Button mBtnPriority; @Bind(R.id.btnDownLoad) Button mBtnDownLoad; @Bind(R.id.btnBackground) Button mBtnBackground; @Bind(R.id.ivTonLeft) ImageView mIvTonLeft; @Bind(R.id.ivTonyRight) ImageView mIvTonyRight; private Context mContext; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_simple); ButterKnife.bind(this); mContext = this; } private DrawableRequestBuilder getCommGlide() { return Glide.with(mContext)
.load(Url.IMAGE_URL_PERU)
zhouruikevin/ImageLoadPK
imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/BaseHolder.java
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchInterface.java // public interface WatchInterface { // void initWatcher(final String tag, WatchListener watchListener); // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // }
import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.ImageView; import com.example.imageloadpk.adapter.watcher.WatchInterface; import com.example.imageloadpk.adapter.watcher.WatchListener;
package com.example.imageloadpk.adapter.holders; /** * Created by Nevermore on 16/7/3. */ public abstract class BaseHolder<V extends ImageView & WatchInterface> extends RecyclerView.ViewHolder { protected final V mImageView;
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchInterface.java // public interface WatchInterface { // void initWatcher(final String tag, WatchListener watchListener); // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // } // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/BaseHolder.java import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.ImageView; import com.example.imageloadpk.adapter.watcher.WatchInterface; import com.example.imageloadpk.adapter.watcher.WatchListener; package com.example.imageloadpk.adapter.holders; /** * Created by Nevermore on 16/7/3. */ public abstract class BaseHolder<V extends ImageView & WatchInterface> extends RecyclerView.ViewHolder { protected final V mImageView;
private final WatchListener mWatchListener;
zhouruikevin/ImageLoadPK
glidesample/src/main/java/example/com/glidesample/ui/ImageViewPagerActivity.java
// Path: glidesample/src/main/java/example/com/glidesample/glide/CustomImageModelLoader.java // public class CustomImageModelLoader extends BaseGlideUrlLoader<CustomImageSizeModel> { // public CustomImageModelLoader(Context context) { // super(context); // } // // @Override // protected String getUrl(CustomImageSizeModel model, int width, int height) { // return model.requestCustomSizeUrl(width, height); // } // } // // Path: glidesample/src/main/java/example/com/glidesample/model/CustomImageSizeModel.java // public interface CustomImageSizeModel { // String requestCustomSizeUrl(int width, int height); // // String getBaseUrl(); // } // // Path: glidesample/src/main/java/example/com/glidesample/model/CustomImageSizeModelImp.java // public class CustomImageSizeModelImp implements CustomImageSizeModel, Parcelable { // private String baseUrl; // private static final String TAG = "CustomImageSizeModelImp"; // // public CustomImageSizeModelImp(String baseUrl) { // this.baseUrl = baseUrl; // } // // // @Override // public String requestCustomSizeUrl(int width, int height) { // String url = baseUrl + "?imageView2/3/h/" + height + "/w/" + width; // Log.d(TAG, "requestCustomSizeUrl: " + url); // return url; // } // // @Override // public String getBaseUrl() { // return baseUrl; // } // // @Override // public int describeContents() { // return 0; // } // // @Override // public void writeToParcel(Parcel dest, int flags) { // dest.writeString(this.baseUrl); // } // // protected CustomImageSizeModelImp(Parcel in) { // this.baseUrl = in.readString(); // } // // public static final Parcelable.Creator<CustomImageSizeModelImp> CREATOR = new Parcelable.Creator<CustomImageSizeModelImp>() { // @Override // public CustomImageSizeModelImp createFromParcel(Parcel source) { // return new CustomImageSizeModelImp(source); // } // // @Override // public CustomImageSizeModelImp[] newArray(int size) { // return new CustomImageSizeModelImp[size]; // } // }; // }
import android.os.Bundle; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.DrawableRequestBuilder; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.resource.drawable.GlideDrawable; import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.target.Target; import java.util.List; import butterknife.Bind; import butterknife.ButterKnife; import example.com.glidesample.glide.CustomImageModelLoader; import example.com.glidesample.R; import example.com.glidesample.model.CustomImageSizeModel; import example.com.glidesample.model.CustomImageSizeModelImp; import uk.co.senab.photoview.PhotoViewAttacher;
package example.com.glidesample.ui; public class ImageViewPagerActivity extends AppCompatActivity { @Bind(R.id.viewPager) ViewPager mViewPager; @Bind(R.id.tvLocation) TextView mTvLocation;
// Path: glidesample/src/main/java/example/com/glidesample/glide/CustomImageModelLoader.java // public class CustomImageModelLoader extends BaseGlideUrlLoader<CustomImageSizeModel> { // public CustomImageModelLoader(Context context) { // super(context); // } // // @Override // protected String getUrl(CustomImageSizeModel model, int width, int height) { // return model.requestCustomSizeUrl(width, height); // } // } // // Path: glidesample/src/main/java/example/com/glidesample/model/CustomImageSizeModel.java // public interface CustomImageSizeModel { // String requestCustomSizeUrl(int width, int height); // // String getBaseUrl(); // } // // Path: glidesample/src/main/java/example/com/glidesample/model/CustomImageSizeModelImp.java // public class CustomImageSizeModelImp implements CustomImageSizeModel, Parcelable { // private String baseUrl; // private static final String TAG = "CustomImageSizeModelImp"; // // public CustomImageSizeModelImp(String baseUrl) { // this.baseUrl = baseUrl; // } // // // @Override // public String requestCustomSizeUrl(int width, int height) { // String url = baseUrl + "?imageView2/3/h/" + height + "/w/" + width; // Log.d(TAG, "requestCustomSizeUrl: " + url); // return url; // } // // @Override // public String getBaseUrl() { // return baseUrl; // } // // @Override // public int describeContents() { // return 0; // } // // @Override // public void writeToParcel(Parcel dest, int flags) { // dest.writeString(this.baseUrl); // } // // protected CustomImageSizeModelImp(Parcel in) { // this.baseUrl = in.readString(); // } // // public static final Parcelable.Creator<CustomImageSizeModelImp> CREATOR = new Parcelable.Creator<CustomImageSizeModelImp>() { // @Override // public CustomImageSizeModelImp createFromParcel(Parcel source) { // return new CustomImageSizeModelImp(source); // } // // @Override // public CustomImageSizeModelImp[] newArray(int size) { // return new CustomImageSizeModelImp[size]; // } // }; // } // Path: glidesample/src/main/java/example/com/glidesample/ui/ImageViewPagerActivity.java import android.os.Bundle; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.DrawableRequestBuilder; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.resource.drawable.GlideDrawable; import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.target.Target; import java.util.List; import butterknife.Bind; import butterknife.ButterKnife; import example.com.glidesample.glide.CustomImageModelLoader; import example.com.glidesample.R; import example.com.glidesample.model.CustomImageSizeModel; import example.com.glidesample.model.CustomImageSizeModelImp; import uk.co.senab.photoview.PhotoViewAttacher; package example.com.glidesample.ui; public class ImageViewPagerActivity extends AppCompatActivity { @Bind(R.id.viewPager) ViewPager mViewPager; @Bind(R.id.tvLocation) TextView mTvLocation;
private List<CustomImageSizeModelImp> mDatas;
zhouruikevin/ImageLoadPK
glidesample/src/main/java/example/com/glidesample/ui/ImageViewPagerActivity.java
// Path: glidesample/src/main/java/example/com/glidesample/glide/CustomImageModelLoader.java // public class CustomImageModelLoader extends BaseGlideUrlLoader<CustomImageSizeModel> { // public CustomImageModelLoader(Context context) { // super(context); // } // // @Override // protected String getUrl(CustomImageSizeModel model, int width, int height) { // return model.requestCustomSizeUrl(width, height); // } // } // // Path: glidesample/src/main/java/example/com/glidesample/model/CustomImageSizeModel.java // public interface CustomImageSizeModel { // String requestCustomSizeUrl(int width, int height); // // String getBaseUrl(); // } // // Path: glidesample/src/main/java/example/com/glidesample/model/CustomImageSizeModelImp.java // public class CustomImageSizeModelImp implements CustomImageSizeModel, Parcelable { // private String baseUrl; // private static final String TAG = "CustomImageSizeModelImp"; // // public CustomImageSizeModelImp(String baseUrl) { // this.baseUrl = baseUrl; // } // // // @Override // public String requestCustomSizeUrl(int width, int height) { // String url = baseUrl + "?imageView2/3/h/" + height + "/w/" + width; // Log.d(TAG, "requestCustomSizeUrl: " + url); // return url; // } // // @Override // public String getBaseUrl() { // return baseUrl; // } // // @Override // public int describeContents() { // return 0; // } // // @Override // public void writeToParcel(Parcel dest, int flags) { // dest.writeString(this.baseUrl); // } // // protected CustomImageSizeModelImp(Parcel in) { // this.baseUrl = in.readString(); // } // // public static final Parcelable.Creator<CustomImageSizeModelImp> CREATOR = new Parcelable.Creator<CustomImageSizeModelImp>() { // @Override // public CustomImageSizeModelImp createFromParcel(Parcel source) { // return new CustomImageSizeModelImp(source); // } // // @Override // public CustomImageSizeModelImp[] newArray(int size) { // return new CustomImageSizeModelImp[size]; // } // }; // }
import android.os.Bundle; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.DrawableRequestBuilder; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.resource.drawable.GlideDrawable; import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.target.Target; import java.util.List; import butterknife.Bind; import butterknife.ButterKnife; import example.com.glidesample.glide.CustomImageModelLoader; import example.com.glidesample.R; import example.com.glidesample.model.CustomImageSizeModel; import example.com.glidesample.model.CustomImageSizeModelImp; import uk.co.senab.photoview.PhotoViewAttacher;
} @Override public View instantiateItem(ViewGroup container, final int position) { View parent = LayoutInflater.from(container.getContext()).inflate(R.layout.activity_image_detial, container, false); container.addView(parent); View downLoad = parent.findViewById(R.id.tvDownload); View loading = parent.findViewById(R.id.progressBar); downLoad.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { downloadImage(mDatas.get(position).getBaseUrl()); } }); downLoad.setTag(mDatas.get(position).getBaseUrl()); ImageView imageView = (ImageView) parent.findViewById(R.id.imageView); displayImage(mDatas.get(position), imageView, loading, downLoad); return parent; } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); } @Override public boolean isViewFromObject(View view, Object object) { return view == object; }
// Path: glidesample/src/main/java/example/com/glidesample/glide/CustomImageModelLoader.java // public class CustomImageModelLoader extends BaseGlideUrlLoader<CustomImageSizeModel> { // public CustomImageModelLoader(Context context) { // super(context); // } // // @Override // protected String getUrl(CustomImageSizeModel model, int width, int height) { // return model.requestCustomSizeUrl(width, height); // } // } // // Path: glidesample/src/main/java/example/com/glidesample/model/CustomImageSizeModel.java // public interface CustomImageSizeModel { // String requestCustomSizeUrl(int width, int height); // // String getBaseUrl(); // } // // Path: glidesample/src/main/java/example/com/glidesample/model/CustomImageSizeModelImp.java // public class CustomImageSizeModelImp implements CustomImageSizeModel, Parcelable { // private String baseUrl; // private static final String TAG = "CustomImageSizeModelImp"; // // public CustomImageSizeModelImp(String baseUrl) { // this.baseUrl = baseUrl; // } // // // @Override // public String requestCustomSizeUrl(int width, int height) { // String url = baseUrl + "?imageView2/3/h/" + height + "/w/" + width; // Log.d(TAG, "requestCustomSizeUrl: " + url); // return url; // } // // @Override // public String getBaseUrl() { // return baseUrl; // } // // @Override // public int describeContents() { // return 0; // } // // @Override // public void writeToParcel(Parcel dest, int flags) { // dest.writeString(this.baseUrl); // } // // protected CustomImageSizeModelImp(Parcel in) { // this.baseUrl = in.readString(); // } // // public static final Parcelable.Creator<CustomImageSizeModelImp> CREATOR = new Parcelable.Creator<CustomImageSizeModelImp>() { // @Override // public CustomImageSizeModelImp createFromParcel(Parcel source) { // return new CustomImageSizeModelImp(source); // } // // @Override // public CustomImageSizeModelImp[] newArray(int size) { // return new CustomImageSizeModelImp[size]; // } // }; // } // Path: glidesample/src/main/java/example/com/glidesample/ui/ImageViewPagerActivity.java import android.os.Bundle; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.DrawableRequestBuilder; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.resource.drawable.GlideDrawable; import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.target.Target; import java.util.List; import butterknife.Bind; import butterknife.ButterKnife; import example.com.glidesample.glide.CustomImageModelLoader; import example.com.glidesample.R; import example.com.glidesample.model.CustomImageSizeModel; import example.com.glidesample.model.CustomImageSizeModelImp; import uk.co.senab.photoview.PhotoViewAttacher; } @Override public View instantiateItem(ViewGroup container, final int position) { View parent = LayoutInflater.from(container.getContext()).inflate(R.layout.activity_image_detial, container, false); container.addView(parent); View downLoad = parent.findViewById(R.id.tvDownload); View loading = parent.findViewById(R.id.progressBar); downLoad.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { downloadImage(mDatas.get(position).getBaseUrl()); } }); downLoad.setTag(mDatas.get(position).getBaseUrl()); ImageView imageView = (ImageView) parent.findViewById(R.id.imageView); displayImage(mDatas.get(position), imageView, loading, downLoad); return parent; } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); } @Override public boolean isViewFromObject(View view, Object object) { return view == object; }
void displayImage(final CustomImageSizeModel model, final ImageView imageView, final View loading, final View download) {
zhouruikevin/ImageLoadPK
glidesample/src/main/java/example/com/glidesample/ui/ImageViewPagerActivity.java
// Path: glidesample/src/main/java/example/com/glidesample/glide/CustomImageModelLoader.java // public class CustomImageModelLoader extends BaseGlideUrlLoader<CustomImageSizeModel> { // public CustomImageModelLoader(Context context) { // super(context); // } // // @Override // protected String getUrl(CustomImageSizeModel model, int width, int height) { // return model.requestCustomSizeUrl(width, height); // } // } // // Path: glidesample/src/main/java/example/com/glidesample/model/CustomImageSizeModel.java // public interface CustomImageSizeModel { // String requestCustomSizeUrl(int width, int height); // // String getBaseUrl(); // } // // Path: glidesample/src/main/java/example/com/glidesample/model/CustomImageSizeModelImp.java // public class CustomImageSizeModelImp implements CustomImageSizeModel, Parcelable { // private String baseUrl; // private static final String TAG = "CustomImageSizeModelImp"; // // public CustomImageSizeModelImp(String baseUrl) { // this.baseUrl = baseUrl; // } // // // @Override // public String requestCustomSizeUrl(int width, int height) { // String url = baseUrl + "?imageView2/3/h/" + height + "/w/" + width; // Log.d(TAG, "requestCustomSizeUrl: " + url); // return url; // } // // @Override // public String getBaseUrl() { // return baseUrl; // } // // @Override // public int describeContents() { // return 0; // } // // @Override // public void writeToParcel(Parcel dest, int flags) { // dest.writeString(this.baseUrl); // } // // protected CustomImageSizeModelImp(Parcel in) { // this.baseUrl = in.readString(); // } // // public static final Parcelable.Creator<CustomImageSizeModelImp> CREATOR = new Parcelable.Creator<CustomImageSizeModelImp>() { // @Override // public CustomImageSizeModelImp createFromParcel(Parcel source) { // return new CustomImageSizeModelImp(source); // } // // @Override // public CustomImageSizeModelImp[] newArray(int size) { // return new CustomImageSizeModelImp[size]; // } // }; // }
import android.os.Bundle; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.DrawableRequestBuilder; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.resource.drawable.GlideDrawable; import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.target.Target; import java.util.List; import butterknife.Bind; import butterknife.ButterKnife; import example.com.glidesample.glide.CustomImageModelLoader; import example.com.glidesample.R; import example.com.glidesample.model.CustomImageSizeModel; import example.com.glidesample.model.CustomImageSizeModelImp; import uk.co.senab.photoview.PhotoViewAttacher;
public void onClick(View v) { downloadImage(mDatas.get(position).getBaseUrl()); } }); downLoad.setTag(mDatas.get(position).getBaseUrl()); ImageView imageView = (ImageView) parent.findViewById(R.id.imageView); displayImage(mDatas.get(position), imageView, loading, downLoad); return parent; } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); } @Override public boolean isViewFromObject(View view, Object object) { return view == object; } void displayImage(final CustomImageSizeModel model, final ImageView imageView, final View loading, final View download) { DrawableRequestBuilder thumbnailBuilder = Glide .with(imageView.getContext()) .load(new CustomImageSizeModelImp(model .getBaseUrl()) .requestCustomSizeUrl(100, 50)) .skipMemoryCache(true) .diskCacheStrategy(DiskCacheStrategy.NONE); Glide.with(ImageViewPagerActivity.this)
// Path: glidesample/src/main/java/example/com/glidesample/glide/CustomImageModelLoader.java // public class CustomImageModelLoader extends BaseGlideUrlLoader<CustomImageSizeModel> { // public CustomImageModelLoader(Context context) { // super(context); // } // // @Override // protected String getUrl(CustomImageSizeModel model, int width, int height) { // return model.requestCustomSizeUrl(width, height); // } // } // // Path: glidesample/src/main/java/example/com/glidesample/model/CustomImageSizeModel.java // public interface CustomImageSizeModel { // String requestCustomSizeUrl(int width, int height); // // String getBaseUrl(); // } // // Path: glidesample/src/main/java/example/com/glidesample/model/CustomImageSizeModelImp.java // public class CustomImageSizeModelImp implements CustomImageSizeModel, Parcelable { // private String baseUrl; // private static final String TAG = "CustomImageSizeModelImp"; // // public CustomImageSizeModelImp(String baseUrl) { // this.baseUrl = baseUrl; // } // // // @Override // public String requestCustomSizeUrl(int width, int height) { // String url = baseUrl + "?imageView2/3/h/" + height + "/w/" + width; // Log.d(TAG, "requestCustomSizeUrl: " + url); // return url; // } // // @Override // public String getBaseUrl() { // return baseUrl; // } // // @Override // public int describeContents() { // return 0; // } // // @Override // public void writeToParcel(Parcel dest, int flags) { // dest.writeString(this.baseUrl); // } // // protected CustomImageSizeModelImp(Parcel in) { // this.baseUrl = in.readString(); // } // // public static final Parcelable.Creator<CustomImageSizeModelImp> CREATOR = new Parcelable.Creator<CustomImageSizeModelImp>() { // @Override // public CustomImageSizeModelImp createFromParcel(Parcel source) { // return new CustomImageSizeModelImp(source); // } // // @Override // public CustomImageSizeModelImp[] newArray(int size) { // return new CustomImageSizeModelImp[size]; // } // }; // } // Path: glidesample/src/main/java/example/com/glidesample/ui/ImageViewPagerActivity.java import android.os.Bundle; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.DrawableRequestBuilder; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.resource.drawable.GlideDrawable; import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.target.Target; import java.util.List; import butterknife.Bind; import butterknife.ButterKnife; import example.com.glidesample.glide.CustomImageModelLoader; import example.com.glidesample.R; import example.com.glidesample.model.CustomImageSizeModel; import example.com.glidesample.model.CustomImageSizeModelImp; import uk.co.senab.photoview.PhotoViewAttacher; public void onClick(View v) { downloadImage(mDatas.get(position).getBaseUrl()); } }); downLoad.setTag(mDatas.get(position).getBaseUrl()); ImageView imageView = (ImageView) parent.findViewById(R.id.imageView); displayImage(mDatas.get(position), imageView, loading, downLoad); return parent; } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); } @Override public boolean isViewFromObject(View view, Object object) { return view == object; } void displayImage(final CustomImageSizeModel model, final ImageView imageView, final View loading, final View download) { DrawableRequestBuilder thumbnailBuilder = Glide .with(imageView.getContext()) .load(new CustomImageSizeModelImp(model .getBaseUrl()) .requestCustomSizeUrl(100, 50)) .skipMemoryCache(true) .diskCacheStrategy(DiskCacheStrategy.NONE); Glide.with(ImageViewPagerActivity.this)
.using(new CustomImageModelLoader(imageView.getContext()))
zhouruikevin/ImageLoadPK
imageloadpk/src/main/java/com/example/imageloadpk/adapter/adapters/ImageLoaderAdapter.java
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/config/ImageLoaderFactory.java // public class ImageLoaderFactory { // private static ImageLoader sImageLoader; // // // public static ImageLoader getImageLoader(Context context) { // // // if (sImageLoader == null) { // ImageLoaderConfiguration imageLoaderConfiguration = new ImageLoaderConfiguration.Builder(context) // .diskCacheSize(ConfigConstants.MAX_CACHE_DISK_SIZE) // .memoryCacheSize(ConfigConstants.MAX_CACHE_MEMORY_SIZE) // .build(); // // sImageLoader = ImageLoader.getInstance(); // sImageLoader.init(imageLoaderConfiguration); // } // return sImageLoader; // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/ImageLoaderHolder.java // public class ImageLoaderHolder extends BaseHolder { // // private final ImageLoader mImageLoader; // DisplayImageOptions mImageOptions; // // public ImageLoaderHolder(ImageView imageView, WatchListener watchListener, View parentView, Context context, ImageLoader imageLoader) { // super(imageView, watchListener, parentView, context); // mImageLoader = imageLoader; // // if (mImageOptions == null) { // mImageOptions = new DisplayImageOptions.Builder() // .showImageOnLoading(Drawables.sPlaceholderDrawable) // .showImageOnFail(Drawables.sErrorDrawable) // .cacheInMemory(true) //不使用内存缓存 // .cacheOnDisk(true) //不使用硬盘缓存 // .build(); // } // } // // @Override // protected void onBind(String url) { // mImageLoader.displayImage(url, mImageView, mImageOptions); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchImageView.java // public class WatchImageView extends ImageView implements WatchInterface { // private final WatchImpl mWatcher; // // public WatchImageView(Context context) { // super(context); // //设置图片填充样式为按比例填满控件 // setScaleType(ScaleType.CENTER_CROP); // mWatcher = new WatchImpl(this); // } // // // @Override // protected void onDraw(Canvas canvas) { // super.onDraw(canvas); // //绘制结果会用到,通过mWatcher转发 // mWatcher.onDraw(canvas); // } // // // 禁用这个方法,防止框架使用它显示图片,影响我们测试显示 // @Override // public void setImageURI(Uri uri) { // throw new UnsupportedOperationException(); // } // // @Override // public void initWatcher(String tag, WatchListener watchListener) { // mWatcher.init(tag, watchListener); // mWatcher.onStart(); //初始化 // } // // @Override // public void setImageDrawable(Drawable drawable) { // // Preconditions.checkNotNull(drawable); // if (drawable == Drawables.sPlaceholderDrawable) { // //不再这里调用,在初始化加载器,Glide.build()实现调用更好 // } else if (drawable == Drawables.sErrorDrawable) { // mWatcher.onFailure();//加载失败 // } else { // mWatcher.onSuccess();//加载成功 // } // super.setImageDrawable(drawable); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // }
import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.ViewGroup; import com.example.imageloadpk.adapter.config.ImageLoaderFactory; import com.example.imageloadpk.adapter.holders.ImageLoaderHolder; import com.example.imageloadpk.adapter.watcher.WatchImageView; import com.example.imageloadpk.adapter.watcher.WatchListener; import com.nostra13.universalimageloader.core.ImageLoader;
package com.example.imageloadpk.adapter.adapters; /** * Created by Administrator on 2016/7/4. */ public class ImageLoaderAdapter extends ImageListAdapter { final private ImageLoader mImageLoader;
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/config/ImageLoaderFactory.java // public class ImageLoaderFactory { // private static ImageLoader sImageLoader; // // // public static ImageLoader getImageLoader(Context context) { // // // if (sImageLoader == null) { // ImageLoaderConfiguration imageLoaderConfiguration = new ImageLoaderConfiguration.Builder(context) // .diskCacheSize(ConfigConstants.MAX_CACHE_DISK_SIZE) // .memoryCacheSize(ConfigConstants.MAX_CACHE_MEMORY_SIZE) // .build(); // // sImageLoader = ImageLoader.getInstance(); // sImageLoader.init(imageLoaderConfiguration); // } // return sImageLoader; // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/ImageLoaderHolder.java // public class ImageLoaderHolder extends BaseHolder { // // private final ImageLoader mImageLoader; // DisplayImageOptions mImageOptions; // // public ImageLoaderHolder(ImageView imageView, WatchListener watchListener, View parentView, Context context, ImageLoader imageLoader) { // super(imageView, watchListener, parentView, context); // mImageLoader = imageLoader; // // if (mImageOptions == null) { // mImageOptions = new DisplayImageOptions.Builder() // .showImageOnLoading(Drawables.sPlaceholderDrawable) // .showImageOnFail(Drawables.sErrorDrawable) // .cacheInMemory(true) //不使用内存缓存 // .cacheOnDisk(true) //不使用硬盘缓存 // .build(); // } // } // // @Override // protected void onBind(String url) { // mImageLoader.displayImage(url, mImageView, mImageOptions); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchImageView.java // public class WatchImageView extends ImageView implements WatchInterface { // private final WatchImpl mWatcher; // // public WatchImageView(Context context) { // super(context); // //设置图片填充样式为按比例填满控件 // setScaleType(ScaleType.CENTER_CROP); // mWatcher = new WatchImpl(this); // } // // // @Override // protected void onDraw(Canvas canvas) { // super.onDraw(canvas); // //绘制结果会用到,通过mWatcher转发 // mWatcher.onDraw(canvas); // } // // // 禁用这个方法,防止框架使用它显示图片,影响我们测试显示 // @Override // public void setImageURI(Uri uri) { // throw new UnsupportedOperationException(); // } // // @Override // public void initWatcher(String tag, WatchListener watchListener) { // mWatcher.init(tag, watchListener); // mWatcher.onStart(); //初始化 // } // // @Override // public void setImageDrawable(Drawable drawable) { // // Preconditions.checkNotNull(drawable); // if (drawable == Drawables.sPlaceholderDrawable) { // //不再这里调用,在初始化加载器,Glide.build()实现调用更好 // } else if (drawable == Drawables.sErrorDrawable) { // mWatcher.onFailure();//加载失败 // } else { // mWatcher.onSuccess();//加载成功 // } // super.setImageDrawable(drawable); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // } // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/adapters/ImageLoaderAdapter.java import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.ViewGroup; import com.example.imageloadpk.adapter.config.ImageLoaderFactory; import com.example.imageloadpk.adapter.holders.ImageLoaderHolder; import com.example.imageloadpk.adapter.watcher.WatchImageView; import com.example.imageloadpk.adapter.watcher.WatchListener; import com.nostra13.universalimageloader.core.ImageLoader; package com.example.imageloadpk.adapter.adapters; /** * Created by Administrator on 2016/7/4. */ public class ImageLoaderAdapter extends ImageListAdapter { final private ImageLoader mImageLoader;
public ImageLoaderAdapter(Context context, WatchListener watchListener) {
zhouruikevin/ImageLoadPK
imageloadpk/src/main/java/com/example/imageloadpk/adapter/adapters/ImageLoaderAdapter.java
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/config/ImageLoaderFactory.java // public class ImageLoaderFactory { // private static ImageLoader sImageLoader; // // // public static ImageLoader getImageLoader(Context context) { // // // if (sImageLoader == null) { // ImageLoaderConfiguration imageLoaderConfiguration = new ImageLoaderConfiguration.Builder(context) // .diskCacheSize(ConfigConstants.MAX_CACHE_DISK_SIZE) // .memoryCacheSize(ConfigConstants.MAX_CACHE_MEMORY_SIZE) // .build(); // // sImageLoader = ImageLoader.getInstance(); // sImageLoader.init(imageLoaderConfiguration); // } // return sImageLoader; // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/ImageLoaderHolder.java // public class ImageLoaderHolder extends BaseHolder { // // private final ImageLoader mImageLoader; // DisplayImageOptions mImageOptions; // // public ImageLoaderHolder(ImageView imageView, WatchListener watchListener, View parentView, Context context, ImageLoader imageLoader) { // super(imageView, watchListener, parentView, context); // mImageLoader = imageLoader; // // if (mImageOptions == null) { // mImageOptions = new DisplayImageOptions.Builder() // .showImageOnLoading(Drawables.sPlaceholderDrawable) // .showImageOnFail(Drawables.sErrorDrawable) // .cacheInMemory(true) //不使用内存缓存 // .cacheOnDisk(true) //不使用硬盘缓存 // .build(); // } // } // // @Override // protected void onBind(String url) { // mImageLoader.displayImage(url, mImageView, mImageOptions); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchImageView.java // public class WatchImageView extends ImageView implements WatchInterface { // private final WatchImpl mWatcher; // // public WatchImageView(Context context) { // super(context); // //设置图片填充样式为按比例填满控件 // setScaleType(ScaleType.CENTER_CROP); // mWatcher = new WatchImpl(this); // } // // // @Override // protected void onDraw(Canvas canvas) { // super.onDraw(canvas); // //绘制结果会用到,通过mWatcher转发 // mWatcher.onDraw(canvas); // } // // // 禁用这个方法,防止框架使用它显示图片,影响我们测试显示 // @Override // public void setImageURI(Uri uri) { // throw new UnsupportedOperationException(); // } // // @Override // public void initWatcher(String tag, WatchListener watchListener) { // mWatcher.init(tag, watchListener); // mWatcher.onStart(); //初始化 // } // // @Override // public void setImageDrawable(Drawable drawable) { // // Preconditions.checkNotNull(drawable); // if (drawable == Drawables.sPlaceholderDrawable) { // //不再这里调用,在初始化加载器,Glide.build()实现调用更好 // } else if (drawable == Drawables.sErrorDrawable) { // mWatcher.onFailure();//加载失败 // } else { // mWatcher.onSuccess();//加载成功 // } // super.setImageDrawable(drawable); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // }
import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.ViewGroup; import com.example.imageloadpk.adapter.config.ImageLoaderFactory; import com.example.imageloadpk.adapter.holders.ImageLoaderHolder; import com.example.imageloadpk.adapter.watcher.WatchImageView; import com.example.imageloadpk.adapter.watcher.WatchListener; import com.nostra13.universalimageloader.core.ImageLoader;
package com.example.imageloadpk.adapter.adapters; /** * Created by Administrator on 2016/7/4. */ public class ImageLoaderAdapter extends ImageListAdapter { final private ImageLoader mImageLoader; public ImageLoaderAdapter(Context context, WatchListener watchListener) { super(context, watchListener);
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/config/ImageLoaderFactory.java // public class ImageLoaderFactory { // private static ImageLoader sImageLoader; // // // public static ImageLoader getImageLoader(Context context) { // // // if (sImageLoader == null) { // ImageLoaderConfiguration imageLoaderConfiguration = new ImageLoaderConfiguration.Builder(context) // .diskCacheSize(ConfigConstants.MAX_CACHE_DISK_SIZE) // .memoryCacheSize(ConfigConstants.MAX_CACHE_MEMORY_SIZE) // .build(); // // sImageLoader = ImageLoader.getInstance(); // sImageLoader.init(imageLoaderConfiguration); // } // return sImageLoader; // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/ImageLoaderHolder.java // public class ImageLoaderHolder extends BaseHolder { // // private final ImageLoader mImageLoader; // DisplayImageOptions mImageOptions; // // public ImageLoaderHolder(ImageView imageView, WatchListener watchListener, View parentView, Context context, ImageLoader imageLoader) { // super(imageView, watchListener, parentView, context); // mImageLoader = imageLoader; // // if (mImageOptions == null) { // mImageOptions = new DisplayImageOptions.Builder() // .showImageOnLoading(Drawables.sPlaceholderDrawable) // .showImageOnFail(Drawables.sErrorDrawable) // .cacheInMemory(true) //不使用内存缓存 // .cacheOnDisk(true) //不使用硬盘缓存 // .build(); // } // } // // @Override // protected void onBind(String url) { // mImageLoader.displayImage(url, mImageView, mImageOptions); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchImageView.java // public class WatchImageView extends ImageView implements WatchInterface { // private final WatchImpl mWatcher; // // public WatchImageView(Context context) { // super(context); // //设置图片填充样式为按比例填满控件 // setScaleType(ScaleType.CENTER_CROP); // mWatcher = new WatchImpl(this); // } // // // @Override // protected void onDraw(Canvas canvas) { // super.onDraw(canvas); // //绘制结果会用到,通过mWatcher转发 // mWatcher.onDraw(canvas); // } // // // 禁用这个方法,防止框架使用它显示图片,影响我们测试显示 // @Override // public void setImageURI(Uri uri) { // throw new UnsupportedOperationException(); // } // // @Override // public void initWatcher(String tag, WatchListener watchListener) { // mWatcher.init(tag, watchListener); // mWatcher.onStart(); //初始化 // } // // @Override // public void setImageDrawable(Drawable drawable) { // // Preconditions.checkNotNull(drawable); // if (drawable == Drawables.sPlaceholderDrawable) { // //不再这里调用,在初始化加载器,Glide.build()实现调用更好 // } else if (drawable == Drawables.sErrorDrawable) { // mWatcher.onFailure();//加载失败 // } else { // mWatcher.onSuccess();//加载成功 // } // super.setImageDrawable(drawable); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // } // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/adapters/ImageLoaderAdapter.java import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.ViewGroup; import com.example.imageloadpk.adapter.config.ImageLoaderFactory; import com.example.imageloadpk.adapter.holders.ImageLoaderHolder; import com.example.imageloadpk.adapter.watcher.WatchImageView; import com.example.imageloadpk.adapter.watcher.WatchListener; import com.nostra13.universalimageloader.core.ImageLoader; package com.example.imageloadpk.adapter.adapters; /** * Created by Administrator on 2016/7/4. */ public class ImageLoaderAdapter extends ImageListAdapter { final private ImageLoader mImageLoader; public ImageLoaderAdapter(Context context, WatchListener watchListener) { super(context, watchListener);
mImageLoader = ImageLoaderFactory.getImageLoader(context);
zhouruikevin/ImageLoadPK
glidesample/src/main/java/example/com/glidesample/glide/CustomImageSizeGlideModule.java
// Path: glidesample/src/main/java/example/com/glidesample/model/CustomImageSizeModel.java // public interface CustomImageSizeModel { // String requestCustomSizeUrl(int width, int height); // // String getBaseUrl(); // }
import android.content.Context; import android.util.Log; import com.bumptech.glide.Glide; import com.bumptech.glide.GlideBuilder; import com.bumptech.glide.module.GlideModule; import java.io.InputStream; import example.com.glidesample.model.CustomImageSizeModel;
package example.com.glidesample.glide; /** * Created by Administrator on 2016/7/7. */ public class CustomImageSizeGlideModule implements GlideModule { @Override public void applyOptions(Context context, GlideBuilder builder) { } @Override public void registerComponents(Context context, Glide glide) {
// Path: glidesample/src/main/java/example/com/glidesample/model/CustomImageSizeModel.java // public interface CustomImageSizeModel { // String requestCustomSizeUrl(int width, int height); // // String getBaseUrl(); // } // Path: glidesample/src/main/java/example/com/glidesample/glide/CustomImageSizeGlideModule.java import android.content.Context; import android.util.Log; import com.bumptech.glide.Glide; import com.bumptech.glide.GlideBuilder; import com.bumptech.glide.module.GlideModule; import java.io.InputStream; import example.com.glidesample.model.CustomImageSizeModel; package example.com.glidesample.glide; /** * Created by Administrator on 2016/7/7. */ public class CustomImageSizeGlideModule implements GlideModule { @Override public void applyOptions(Context context, GlideBuilder builder) { } @Override public void registerComponents(Context context, Glide glide) {
glide.register(CustomImageSizeModel.class, InputStream.class, new CustomImageSizeModelFactory());
zhouruikevin/ImageLoadPK
imageloadpk/src/main/java/com/example/imageloadpk/adapter/adapters/PicassoAdapter.java
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/config/PicassoConfigFactory.java // public class PicassoConfigFactory { // private static Picasso sPicasso; // // public static Picasso getPicasso(Context context) { // if (sPicasso == null) { // sPicasso = new Picasso.Builder(context) // //硬盘缓存池大小 // .downloader(new OkHttpDownloader(context, ConfigConstants.MAX_CACHE_DISK_SIZE)) // //内存缓存池大小 // .memoryCache(new LruCache(ConfigConstants.MAX_CACHE_MEMORY_SIZE)) // // .defaultBitmapConfig(Bitmap.Config.ARGB_4444) // .build(); // } // return sPicasso; // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/PicassoHolder.java // public class PicassoHolder extends BaseHolder { // private final Picasso mPicasso; // // public PicassoHolder(ImageView imageView, WatchListener watchListener, View parentView, Context context, Picasso picasso) { // super(imageView, watchListener, parentView, context); // mPicasso = picasso; // } // // @Override // protected void onBind(String url) { // mPicasso.load(url) // .placeholder(Drawables.sPlaceholderDrawable) // .error(Drawables.sErrorDrawable) // // .memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE)//不使用内存缓存 // // .networkPolicy(NetworkPolicy.NO_CACHE, NetworkPolicy.NO_STORE)//不使用磁盘缓存 // // .fit() // // .into(mImageView); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchImageView.java // public class WatchImageView extends ImageView implements WatchInterface { // private final WatchImpl mWatcher; // // public WatchImageView(Context context) { // super(context); // //设置图片填充样式为按比例填满控件 // setScaleType(ScaleType.CENTER_CROP); // mWatcher = new WatchImpl(this); // } // // // @Override // protected void onDraw(Canvas canvas) { // super.onDraw(canvas); // //绘制结果会用到,通过mWatcher转发 // mWatcher.onDraw(canvas); // } // // // 禁用这个方法,防止框架使用它显示图片,影响我们测试显示 // @Override // public void setImageURI(Uri uri) { // throw new UnsupportedOperationException(); // } // // @Override // public void initWatcher(String tag, WatchListener watchListener) { // mWatcher.init(tag, watchListener); // mWatcher.onStart(); //初始化 // } // // @Override // public void setImageDrawable(Drawable drawable) { // // Preconditions.checkNotNull(drawable); // if (drawable == Drawables.sPlaceholderDrawable) { // //不再这里调用,在初始化加载器,Glide.build()实现调用更好 // } else if (drawable == Drawables.sErrorDrawable) { // mWatcher.onFailure();//加载失败 // } else { // mWatcher.onSuccess();//加载成功 // } // super.setImageDrawable(drawable); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // }
import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.ViewGroup; import com.example.imageloadpk.adapter.config.PicassoConfigFactory; import com.example.imageloadpk.adapter.holders.PicassoHolder; import com.example.imageloadpk.adapter.watcher.WatchImageView; import com.example.imageloadpk.adapter.watcher.WatchListener; import com.squareup.picasso.Picasso;
package com.example.imageloadpk.adapter.adapters; /** * Created by Administrator on 2016/7/4. */ public class PicassoAdapter extends ImageListAdapter { private Picasso mPicasso;
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/config/PicassoConfigFactory.java // public class PicassoConfigFactory { // private static Picasso sPicasso; // // public static Picasso getPicasso(Context context) { // if (sPicasso == null) { // sPicasso = new Picasso.Builder(context) // //硬盘缓存池大小 // .downloader(new OkHttpDownloader(context, ConfigConstants.MAX_CACHE_DISK_SIZE)) // //内存缓存池大小 // .memoryCache(new LruCache(ConfigConstants.MAX_CACHE_MEMORY_SIZE)) // // .defaultBitmapConfig(Bitmap.Config.ARGB_4444) // .build(); // } // return sPicasso; // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/PicassoHolder.java // public class PicassoHolder extends BaseHolder { // private final Picasso mPicasso; // // public PicassoHolder(ImageView imageView, WatchListener watchListener, View parentView, Context context, Picasso picasso) { // super(imageView, watchListener, parentView, context); // mPicasso = picasso; // } // // @Override // protected void onBind(String url) { // mPicasso.load(url) // .placeholder(Drawables.sPlaceholderDrawable) // .error(Drawables.sErrorDrawable) // // .memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE)//不使用内存缓存 // // .networkPolicy(NetworkPolicy.NO_CACHE, NetworkPolicy.NO_STORE)//不使用磁盘缓存 // // .fit() // // .into(mImageView); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchImageView.java // public class WatchImageView extends ImageView implements WatchInterface { // private final WatchImpl mWatcher; // // public WatchImageView(Context context) { // super(context); // //设置图片填充样式为按比例填满控件 // setScaleType(ScaleType.CENTER_CROP); // mWatcher = new WatchImpl(this); // } // // // @Override // protected void onDraw(Canvas canvas) { // super.onDraw(canvas); // //绘制结果会用到,通过mWatcher转发 // mWatcher.onDraw(canvas); // } // // // 禁用这个方法,防止框架使用它显示图片,影响我们测试显示 // @Override // public void setImageURI(Uri uri) { // throw new UnsupportedOperationException(); // } // // @Override // public void initWatcher(String tag, WatchListener watchListener) { // mWatcher.init(tag, watchListener); // mWatcher.onStart(); //初始化 // } // // @Override // public void setImageDrawable(Drawable drawable) { // // Preconditions.checkNotNull(drawable); // if (drawable == Drawables.sPlaceholderDrawable) { // //不再这里调用,在初始化加载器,Glide.build()实现调用更好 // } else if (drawable == Drawables.sErrorDrawable) { // mWatcher.onFailure();//加载失败 // } else { // mWatcher.onSuccess();//加载成功 // } // super.setImageDrawable(drawable); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // } // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/adapters/PicassoAdapter.java import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.ViewGroup; import com.example.imageloadpk.adapter.config.PicassoConfigFactory; import com.example.imageloadpk.adapter.holders.PicassoHolder; import com.example.imageloadpk.adapter.watcher.WatchImageView; import com.example.imageloadpk.adapter.watcher.WatchListener; import com.squareup.picasso.Picasso; package com.example.imageloadpk.adapter.adapters; /** * Created by Administrator on 2016/7/4. */ public class PicassoAdapter extends ImageListAdapter { private Picasso mPicasso;
public PicassoAdapter(Context context, WatchListener watchListener) {
zhouruikevin/ImageLoadPK
imageloadpk/src/main/java/com/example/imageloadpk/adapter/adapters/PicassoAdapter.java
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/config/PicassoConfigFactory.java // public class PicassoConfigFactory { // private static Picasso sPicasso; // // public static Picasso getPicasso(Context context) { // if (sPicasso == null) { // sPicasso = new Picasso.Builder(context) // //硬盘缓存池大小 // .downloader(new OkHttpDownloader(context, ConfigConstants.MAX_CACHE_DISK_SIZE)) // //内存缓存池大小 // .memoryCache(new LruCache(ConfigConstants.MAX_CACHE_MEMORY_SIZE)) // // .defaultBitmapConfig(Bitmap.Config.ARGB_4444) // .build(); // } // return sPicasso; // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/PicassoHolder.java // public class PicassoHolder extends BaseHolder { // private final Picasso mPicasso; // // public PicassoHolder(ImageView imageView, WatchListener watchListener, View parentView, Context context, Picasso picasso) { // super(imageView, watchListener, parentView, context); // mPicasso = picasso; // } // // @Override // protected void onBind(String url) { // mPicasso.load(url) // .placeholder(Drawables.sPlaceholderDrawable) // .error(Drawables.sErrorDrawable) // // .memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE)//不使用内存缓存 // // .networkPolicy(NetworkPolicy.NO_CACHE, NetworkPolicy.NO_STORE)//不使用磁盘缓存 // // .fit() // // .into(mImageView); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchImageView.java // public class WatchImageView extends ImageView implements WatchInterface { // private final WatchImpl mWatcher; // // public WatchImageView(Context context) { // super(context); // //设置图片填充样式为按比例填满控件 // setScaleType(ScaleType.CENTER_CROP); // mWatcher = new WatchImpl(this); // } // // // @Override // protected void onDraw(Canvas canvas) { // super.onDraw(canvas); // //绘制结果会用到,通过mWatcher转发 // mWatcher.onDraw(canvas); // } // // // 禁用这个方法,防止框架使用它显示图片,影响我们测试显示 // @Override // public void setImageURI(Uri uri) { // throw new UnsupportedOperationException(); // } // // @Override // public void initWatcher(String tag, WatchListener watchListener) { // mWatcher.init(tag, watchListener); // mWatcher.onStart(); //初始化 // } // // @Override // public void setImageDrawable(Drawable drawable) { // // Preconditions.checkNotNull(drawable); // if (drawable == Drawables.sPlaceholderDrawable) { // //不再这里调用,在初始化加载器,Glide.build()实现调用更好 // } else if (drawable == Drawables.sErrorDrawable) { // mWatcher.onFailure();//加载失败 // } else { // mWatcher.onSuccess();//加载成功 // } // super.setImageDrawable(drawable); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // }
import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.ViewGroup; import com.example.imageloadpk.adapter.config.PicassoConfigFactory; import com.example.imageloadpk.adapter.holders.PicassoHolder; import com.example.imageloadpk.adapter.watcher.WatchImageView; import com.example.imageloadpk.adapter.watcher.WatchListener; import com.squareup.picasso.Picasso;
package com.example.imageloadpk.adapter.adapters; /** * Created by Administrator on 2016/7/4. */ public class PicassoAdapter extends ImageListAdapter { private Picasso mPicasso; public PicassoAdapter(Context context, WatchListener watchListener) { super(context, watchListener); if (mPicasso == null) {
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/config/PicassoConfigFactory.java // public class PicassoConfigFactory { // private static Picasso sPicasso; // // public static Picasso getPicasso(Context context) { // if (sPicasso == null) { // sPicasso = new Picasso.Builder(context) // //硬盘缓存池大小 // .downloader(new OkHttpDownloader(context, ConfigConstants.MAX_CACHE_DISK_SIZE)) // //内存缓存池大小 // .memoryCache(new LruCache(ConfigConstants.MAX_CACHE_MEMORY_SIZE)) // // .defaultBitmapConfig(Bitmap.Config.ARGB_4444) // .build(); // } // return sPicasso; // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/PicassoHolder.java // public class PicassoHolder extends BaseHolder { // private final Picasso mPicasso; // // public PicassoHolder(ImageView imageView, WatchListener watchListener, View parentView, Context context, Picasso picasso) { // super(imageView, watchListener, parentView, context); // mPicasso = picasso; // } // // @Override // protected void onBind(String url) { // mPicasso.load(url) // .placeholder(Drawables.sPlaceholderDrawable) // .error(Drawables.sErrorDrawable) // // .memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE)//不使用内存缓存 // // .networkPolicy(NetworkPolicy.NO_CACHE, NetworkPolicy.NO_STORE)//不使用磁盘缓存 // // .fit() // // .into(mImageView); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchImageView.java // public class WatchImageView extends ImageView implements WatchInterface { // private final WatchImpl mWatcher; // // public WatchImageView(Context context) { // super(context); // //设置图片填充样式为按比例填满控件 // setScaleType(ScaleType.CENTER_CROP); // mWatcher = new WatchImpl(this); // } // // // @Override // protected void onDraw(Canvas canvas) { // super.onDraw(canvas); // //绘制结果会用到,通过mWatcher转发 // mWatcher.onDraw(canvas); // } // // // 禁用这个方法,防止框架使用它显示图片,影响我们测试显示 // @Override // public void setImageURI(Uri uri) { // throw new UnsupportedOperationException(); // } // // @Override // public void initWatcher(String tag, WatchListener watchListener) { // mWatcher.init(tag, watchListener); // mWatcher.onStart(); //初始化 // } // // @Override // public void setImageDrawable(Drawable drawable) { // // Preconditions.checkNotNull(drawable); // if (drawable == Drawables.sPlaceholderDrawable) { // //不再这里调用,在初始化加载器,Glide.build()实现调用更好 // } else if (drawable == Drawables.sErrorDrawable) { // mWatcher.onFailure();//加载失败 // } else { // mWatcher.onSuccess();//加载成功 // } // super.setImageDrawable(drawable); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // } // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/adapters/PicassoAdapter.java import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.ViewGroup; import com.example.imageloadpk.adapter.config.PicassoConfigFactory; import com.example.imageloadpk.adapter.holders.PicassoHolder; import com.example.imageloadpk.adapter.watcher.WatchImageView; import com.example.imageloadpk.adapter.watcher.WatchListener; import com.squareup.picasso.Picasso; package com.example.imageloadpk.adapter.adapters; /** * Created by Administrator on 2016/7/4. */ public class PicassoAdapter extends ImageListAdapter { private Picasso mPicasso; public PicassoAdapter(Context context, WatchListener watchListener) { super(context, watchListener); if (mPicasso == null) {
mPicasso = PicassoConfigFactory.getPicasso(context);
zhouruikevin/ImageLoadPK
imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/ImageLoaderHolder.java
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/Drawables.java // public class Drawables { // public static Drawable sPlaceholderDrawable; // public static Drawable sErrorDrawable; // // private Drawables() { // } // // public static void init(final Resources resources) { // if (sPlaceholderDrawable == null) { // sPlaceholderDrawable = resources.getDrawable(R.drawable.placeholder, null); // } // if (sErrorDrawable == null) { // sErrorDrawable = resources.getDrawable(R.drawable.error, null); // } // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // }
import android.content.Context; import android.view.View; import android.widget.ImageView; import com.example.imageloadpk.adapter.watcher.Drawables; import com.example.imageloadpk.adapter.watcher.WatchListener; import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.ImageLoader;
package com.example.imageloadpk.adapter.holders; /** * Created by Administrator on 2016/7/4. */ public class ImageLoaderHolder extends BaseHolder { private final ImageLoader mImageLoader; DisplayImageOptions mImageOptions;
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/Drawables.java // public class Drawables { // public static Drawable sPlaceholderDrawable; // public static Drawable sErrorDrawable; // // private Drawables() { // } // // public static void init(final Resources resources) { // if (sPlaceholderDrawable == null) { // sPlaceholderDrawable = resources.getDrawable(R.drawable.placeholder, null); // } // if (sErrorDrawable == null) { // sErrorDrawable = resources.getDrawable(R.drawable.error, null); // } // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // } // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/ImageLoaderHolder.java import android.content.Context; import android.view.View; import android.widget.ImageView; import com.example.imageloadpk.adapter.watcher.Drawables; import com.example.imageloadpk.adapter.watcher.WatchListener; import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.ImageLoader; package com.example.imageloadpk.adapter.holders; /** * Created by Administrator on 2016/7/4. */ public class ImageLoaderHolder extends BaseHolder { private final ImageLoader mImageLoader; DisplayImageOptions mImageOptions;
public ImageLoaderHolder(ImageView imageView, WatchListener watchListener, View parentView, Context context, ImageLoader imageLoader) {
zhouruikevin/ImageLoadPK
imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/ImageLoaderHolder.java
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/Drawables.java // public class Drawables { // public static Drawable sPlaceholderDrawable; // public static Drawable sErrorDrawable; // // private Drawables() { // } // // public static void init(final Resources resources) { // if (sPlaceholderDrawable == null) { // sPlaceholderDrawable = resources.getDrawable(R.drawable.placeholder, null); // } // if (sErrorDrawable == null) { // sErrorDrawable = resources.getDrawable(R.drawable.error, null); // } // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // }
import android.content.Context; import android.view.View; import android.widget.ImageView; import com.example.imageloadpk.adapter.watcher.Drawables; import com.example.imageloadpk.adapter.watcher.WatchListener; import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.ImageLoader;
package com.example.imageloadpk.adapter.holders; /** * Created by Administrator on 2016/7/4. */ public class ImageLoaderHolder extends BaseHolder { private final ImageLoader mImageLoader; DisplayImageOptions mImageOptions; public ImageLoaderHolder(ImageView imageView, WatchListener watchListener, View parentView, Context context, ImageLoader imageLoader) { super(imageView, watchListener, parentView, context); mImageLoader = imageLoader; if (mImageOptions == null) { mImageOptions = new DisplayImageOptions.Builder()
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/Drawables.java // public class Drawables { // public static Drawable sPlaceholderDrawable; // public static Drawable sErrorDrawable; // // private Drawables() { // } // // public static void init(final Resources resources) { // if (sPlaceholderDrawable == null) { // sPlaceholderDrawable = resources.getDrawable(R.drawable.placeholder, null); // } // if (sErrorDrawable == null) { // sErrorDrawable = resources.getDrawable(R.drawable.error, null); // } // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // } // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/ImageLoaderHolder.java import android.content.Context; import android.view.View; import android.widget.ImageView; import com.example.imageloadpk.adapter.watcher.Drawables; import com.example.imageloadpk.adapter.watcher.WatchListener; import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.ImageLoader; package com.example.imageloadpk.adapter.holders; /** * Created by Administrator on 2016/7/4. */ public class ImageLoaderHolder extends BaseHolder { private final ImageLoader mImageLoader; DisplayImageOptions mImageOptions; public ImageLoaderHolder(ImageView imageView, WatchListener watchListener, View parentView, Context context, ImageLoader imageLoader) { super(imageView, watchListener, parentView, context); mImageLoader = imageLoader; if (mImageOptions == null) { mImageOptions = new DisplayImageOptions.Builder()
.showImageOnLoading(Drawables.sPlaceholderDrawable)
zhouruikevin/ImageLoadPK
imageloadpk/src/main/java/com/example/imageloadpk/adapter/adapters/GlideAdapter.java
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/GlideHolder.java // public class GlideHolder extends BaseHolder<WatchImageView> { // // public GlideHolder(WatchImageView imageView, WatchListener watchListener, View parentView, Context context) { // super(imageView, watchListener, parentView, context); // } // // public final static String TAG = "GlideHolder"; // private RequestListener<String, GlideDrawable> mRequestListener = new RequestListener<String, GlideDrawable>() { // @Override // public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) { // Log.w(TAG, "onException: ", e); // Log.d(TAG, "onException: " + model); // Log.d(TAG, "onException: " + target.getRequest().isRunning()); // return false; // } // // @Override // public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) { // return false; // } // }; // // @Override // protected void onBind(String url) { // Glide.with(getContext()) // .load(url) // .listener(mRequestListener)//配置监听器 // .placeholder(Drawables.sPlaceholderDrawable) // .error(Drawables.sErrorDrawable) // .centerCrop() // .skipMemoryCache(true) //不使用内存缓存 // .diskCacheStrategy(DiskCacheStrategy.NONE) //不使用硬盘缓存 // .into(mImageView); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchImageView.java // public class WatchImageView extends ImageView implements WatchInterface { // private final WatchImpl mWatcher; // // public WatchImageView(Context context) { // super(context); // //设置图片填充样式为按比例填满控件 // setScaleType(ScaleType.CENTER_CROP); // mWatcher = new WatchImpl(this); // } // // // @Override // protected void onDraw(Canvas canvas) { // super.onDraw(canvas); // //绘制结果会用到,通过mWatcher转发 // mWatcher.onDraw(canvas); // } // // // 禁用这个方法,防止框架使用它显示图片,影响我们测试显示 // @Override // public void setImageURI(Uri uri) { // throw new UnsupportedOperationException(); // } // // @Override // public void initWatcher(String tag, WatchListener watchListener) { // mWatcher.init(tag, watchListener); // mWatcher.onStart(); //初始化 // } // // @Override // public void setImageDrawable(Drawable drawable) { // // Preconditions.checkNotNull(drawable); // if (drawable == Drawables.sPlaceholderDrawable) { // //不再这里调用,在初始化加载器,Glide.build()实现调用更好 // } else if (drawable == Drawables.sErrorDrawable) { // mWatcher.onFailure();//加载失败 // } else { // mWatcher.onSuccess();//加载成功 // } // super.setImageDrawable(drawable); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // }
import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.ViewGroup; import com.bumptech.glide.Glide; import com.example.imageloadpk.adapter.holders.GlideHolder; import com.example.imageloadpk.adapter.watcher.WatchImageView; import com.example.imageloadpk.adapter.watcher.WatchListener;
package com.example.imageloadpk.adapter.adapters; /** * Created by Nevermore on 16/7/1. */ public class GlideAdapter extends ImageListAdapter { public GlideAdapter(Context context, WatchListener watchListener) { super(context, watchListener); } @Override
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/GlideHolder.java // public class GlideHolder extends BaseHolder<WatchImageView> { // // public GlideHolder(WatchImageView imageView, WatchListener watchListener, View parentView, Context context) { // super(imageView, watchListener, parentView, context); // } // // public final static String TAG = "GlideHolder"; // private RequestListener<String, GlideDrawable> mRequestListener = new RequestListener<String, GlideDrawable>() { // @Override // public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) { // Log.w(TAG, "onException: ", e); // Log.d(TAG, "onException: " + model); // Log.d(TAG, "onException: " + target.getRequest().isRunning()); // return false; // } // // @Override // public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) { // return false; // } // }; // // @Override // protected void onBind(String url) { // Glide.with(getContext()) // .load(url) // .listener(mRequestListener)//配置监听器 // .placeholder(Drawables.sPlaceholderDrawable) // .error(Drawables.sErrorDrawable) // .centerCrop() // .skipMemoryCache(true) //不使用内存缓存 // .diskCacheStrategy(DiskCacheStrategy.NONE) //不使用硬盘缓存 // .into(mImageView); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchImageView.java // public class WatchImageView extends ImageView implements WatchInterface { // private final WatchImpl mWatcher; // // public WatchImageView(Context context) { // super(context); // //设置图片填充样式为按比例填满控件 // setScaleType(ScaleType.CENTER_CROP); // mWatcher = new WatchImpl(this); // } // // // @Override // protected void onDraw(Canvas canvas) { // super.onDraw(canvas); // //绘制结果会用到,通过mWatcher转发 // mWatcher.onDraw(canvas); // } // // // 禁用这个方法,防止框架使用它显示图片,影响我们测试显示 // @Override // public void setImageURI(Uri uri) { // throw new UnsupportedOperationException(); // } // // @Override // public void initWatcher(String tag, WatchListener watchListener) { // mWatcher.init(tag, watchListener); // mWatcher.onStart(); //初始化 // } // // @Override // public void setImageDrawable(Drawable drawable) { // // Preconditions.checkNotNull(drawable); // if (drawable == Drawables.sPlaceholderDrawable) { // //不再这里调用,在初始化加载器,Glide.build()实现调用更好 // } else if (drawable == Drawables.sErrorDrawable) { // mWatcher.onFailure();//加载失败 // } else { // mWatcher.onSuccess();//加载成功 // } // super.setImageDrawable(drawable); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // } // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/adapters/GlideAdapter.java import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.ViewGroup; import com.bumptech.glide.Glide; import com.example.imageloadpk.adapter.holders.GlideHolder; import com.example.imageloadpk.adapter.watcher.WatchImageView; import com.example.imageloadpk.adapter.watcher.WatchListener; package com.example.imageloadpk.adapter.adapters; /** * Created by Nevermore on 16/7/1. */ public class GlideAdapter extends ImageListAdapter { public GlideAdapter(Context context, WatchListener watchListener) { super(context, watchListener); } @Override
public GlideHolder onCreateViewHolder(ViewGroup parent, int viewType) {
zhouruikevin/ImageLoadPK
imageloadpk/src/main/java/com/example/imageloadpk/adapter/adapters/GlideAdapter.java
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/GlideHolder.java // public class GlideHolder extends BaseHolder<WatchImageView> { // // public GlideHolder(WatchImageView imageView, WatchListener watchListener, View parentView, Context context) { // super(imageView, watchListener, parentView, context); // } // // public final static String TAG = "GlideHolder"; // private RequestListener<String, GlideDrawable> mRequestListener = new RequestListener<String, GlideDrawable>() { // @Override // public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) { // Log.w(TAG, "onException: ", e); // Log.d(TAG, "onException: " + model); // Log.d(TAG, "onException: " + target.getRequest().isRunning()); // return false; // } // // @Override // public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) { // return false; // } // }; // // @Override // protected void onBind(String url) { // Glide.with(getContext()) // .load(url) // .listener(mRequestListener)//配置监听器 // .placeholder(Drawables.sPlaceholderDrawable) // .error(Drawables.sErrorDrawable) // .centerCrop() // .skipMemoryCache(true) //不使用内存缓存 // .diskCacheStrategy(DiskCacheStrategy.NONE) //不使用硬盘缓存 // .into(mImageView); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchImageView.java // public class WatchImageView extends ImageView implements WatchInterface { // private final WatchImpl mWatcher; // // public WatchImageView(Context context) { // super(context); // //设置图片填充样式为按比例填满控件 // setScaleType(ScaleType.CENTER_CROP); // mWatcher = new WatchImpl(this); // } // // // @Override // protected void onDraw(Canvas canvas) { // super.onDraw(canvas); // //绘制结果会用到,通过mWatcher转发 // mWatcher.onDraw(canvas); // } // // // 禁用这个方法,防止框架使用它显示图片,影响我们测试显示 // @Override // public void setImageURI(Uri uri) { // throw new UnsupportedOperationException(); // } // // @Override // public void initWatcher(String tag, WatchListener watchListener) { // mWatcher.init(tag, watchListener); // mWatcher.onStart(); //初始化 // } // // @Override // public void setImageDrawable(Drawable drawable) { // // Preconditions.checkNotNull(drawable); // if (drawable == Drawables.sPlaceholderDrawable) { // //不再这里调用,在初始化加载器,Glide.build()实现调用更好 // } else if (drawable == Drawables.sErrorDrawable) { // mWatcher.onFailure();//加载失败 // } else { // mWatcher.onSuccess();//加载成功 // } // super.setImageDrawable(drawable); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // }
import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.ViewGroup; import com.bumptech.glide.Glide; import com.example.imageloadpk.adapter.holders.GlideHolder; import com.example.imageloadpk.adapter.watcher.WatchImageView; import com.example.imageloadpk.adapter.watcher.WatchListener;
package com.example.imageloadpk.adapter.adapters; /** * Created by Nevermore on 16/7/1. */ public class GlideAdapter extends ImageListAdapter { public GlideAdapter(Context context, WatchListener watchListener) { super(context, watchListener); } @Override public GlideHolder onCreateViewHolder(ViewGroup parent, int viewType) {
// Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/holders/GlideHolder.java // public class GlideHolder extends BaseHolder<WatchImageView> { // // public GlideHolder(WatchImageView imageView, WatchListener watchListener, View parentView, Context context) { // super(imageView, watchListener, parentView, context); // } // // public final static String TAG = "GlideHolder"; // private RequestListener<String, GlideDrawable> mRequestListener = new RequestListener<String, GlideDrawable>() { // @Override // public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) { // Log.w(TAG, "onException: ", e); // Log.d(TAG, "onException: " + model); // Log.d(TAG, "onException: " + target.getRequest().isRunning()); // return false; // } // // @Override // public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) { // return false; // } // }; // // @Override // protected void onBind(String url) { // Glide.with(getContext()) // .load(url) // .listener(mRequestListener)//配置监听器 // .placeholder(Drawables.sPlaceholderDrawable) // .error(Drawables.sErrorDrawable) // .centerCrop() // .skipMemoryCache(true) //不使用内存缓存 // .diskCacheStrategy(DiskCacheStrategy.NONE) //不使用硬盘缓存 // .into(mImageView); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchImageView.java // public class WatchImageView extends ImageView implements WatchInterface { // private final WatchImpl mWatcher; // // public WatchImageView(Context context) { // super(context); // //设置图片填充样式为按比例填满控件 // setScaleType(ScaleType.CENTER_CROP); // mWatcher = new WatchImpl(this); // } // // // @Override // protected void onDraw(Canvas canvas) { // super.onDraw(canvas); // //绘制结果会用到,通过mWatcher转发 // mWatcher.onDraw(canvas); // } // // // 禁用这个方法,防止框架使用它显示图片,影响我们测试显示 // @Override // public void setImageURI(Uri uri) { // throw new UnsupportedOperationException(); // } // // @Override // public void initWatcher(String tag, WatchListener watchListener) { // mWatcher.init(tag, watchListener); // mWatcher.onStart(); //初始化 // } // // @Override // public void setImageDrawable(Drawable drawable) { // // Preconditions.checkNotNull(drawable); // if (drawable == Drawables.sPlaceholderDrawable) { // //不再这里调用,在初始化加载器,Glide.build()实现调用更好 // } else if (drawable == Drawables.sErrorDrawable) { // mWatcher.onFailure();//加载失败 // } else { // mWatcher.onSuccess();//加载成功 // } // super.setImageDrawable(drawable); // } // } // // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/watcher/WatchListener.java // public class WatchListener { // private long mRequestTotalTime; // private long mStartRequests; // private long mSuccessedRequests; // private long mFailedRequests; // private long mCancelledRequests; // // public void reportSuccess(long requestTime) { // mRequestTotalTime += requestTime; // mSuccessedRequests++; // } // // public void initData() { // mRequestTotalTime = 0; // mStartRequests = 0; // mSuccessedRequests = 0; // mFailedRequests = 0; // mCancelledRequests = 0; // } // // public void reportStart() { // mStartRequests++; // } // // public void reportCancelltion(long requestTime) { // mCancelledRequests++; // mRequestTotalTime += requestTime; // } // // public void reportFailure(long requestTime) { // mFailedRequests++; // mRequestTotalTime += requestTime; // } // // // public long getAverageRequestTime() { // final long completedRequests = getCompletedRequests(); // return completedRequests > 0 ? mRequestTotalTime / completedRequests : 0; // } // // public long getCancelledRequests() { // return mCancelledRequests; // } // // public long getCompletedRequests() { // return mSuccessedRequests + mCancelledRequests + mFailedRequests; // } // // public long getTotalRequests() { // return mStartRequests; // } // } // Path: imageloadpk/src/main/java/com/example/imageloadpk/adapter/adapters/GlideAdapter.java import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.ViewGroup; import com.bumptech.glide.Glide; import com.example.imageloadpk.adapter.holders.GlideHolder; import com.example.imageloadpk.adapter.watcher.WatchImageView; import com.example.imageloadpk.adapter.watcher.WatchListener; package com.example.imageloadpk.adapter.adapters; /** * Created by Nevermore on 16/7/1. */ public class GlideAdapter extends ImageListAdapter { public GlideAdapter(Context context, WatchListener watchListener) { super(context, watchListener); } @Override public GlideHolder onCreateViewHolder(ViewGroup parent, int viewType) {
final WatchImageView watchImageView = new WatchImageView(getContext());
Tonius/SimplyJetpacks
src/main/java/tonius/simplyjetpacks/integration/EIORecipes.java
// Path: src/main/java/tonius/simplyjetpacks/SimplyJetpacks.java // @Mod(modid = SimplyJetpacks.MODID, version = SimplyJetpacks.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES, guiFactory = SimplyJetpacks.GUI_FACTORY) // public class SimplyJetpacks { // // public static final String MODID = "simplyjetpacks"; // public static final String VERSION = "@VERSION@"; // public static final String PREFIX = MODID + "."; // public static final String RESOURCE_PREFIX = MODID + ":"; // public static final String DEPENDENCIES = "required-after:Forge@[10.13.2.1291,);after:ThermalExpansion;after:RedstoneArsenal;after:RArm;after:EnderIO@[1.7.10-2.1.3.243,);after:BuildCraft|Core@[6.4.15,7.0.0),[7.0.4,)"; // public static final String GUI_FACTORY = "tonius.simplyjetpacks.config.ConfigGuiFactory"; // // @Instance(MODID) // public static SimplyJetpacks instance; // @SidedProxy(clientSide = "tonius.simplyjetpacks.client.ClientProxy", serverSide = "tonius.simplyjetpacks.CommonProxy") // public static CommonProxy proxy; // public static Logger logger; // public static SyncHandler keyboard; // // @EventHandler // public static void preInit(FMLPreInitializationEvent evt) { // logger = evt.getModLog(); // logger.info("Starting Simply Jetpacks"); // // checkCoFHLib(); // // Packs.preInit(); // Config.preInit(evt); // ModItems.preInit(); // } // // @EventHandler // public static void init(FMLInitializationEvent evt) { // RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped"); // proxy.registerHandlers(); // PacketHandler.init(); // ModItems.init(); // ModEnchantments.init(); // } // // @EventHandler // public static void serverStopping(FMLServerStoppingEvent evt) { // SyncHandler.clearAll(); // } // // private static void checkCoFHLib() { // try { // Class.forName("cofh.lib.util.helpers.FireworksHelper$Explosion"); // logger.info("Successfully found CoFHLib"); // return; // // } catch (ClassNotFoundException e) { // logger.error("Could not find CoFHLib!"); // proxy.throwCoFHLibException(); // } // } // // }
import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import tonius.simplyjetpacks.SimplyJetpacks; import cpw.mods.fml.common.event.FMLInterModComms;
package tonius.simplyjetpacks.integration; public abstract class EIORecipes { public static void addAlloySmelterRecipe(String name, int energy, ItemStack primaryInput, ItemStack secondaryInput, ItemStack tertiaryInput, ItemStack output) {
// Path: src/main/java/tonius/simplyjetpacks/SimplyJetpacks.java // @Mod(modid = SimplyJetpacks.MODID, version = SimplyJetpacks.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES, guiFactory = SimplyJetpacks.GUI_FACTORY) // public class SimplyJetpacks { // // public static final String MODID = "simplyjetpacks"; // public static final String VERSION = "@VERSION@"; // public static final String PREFIX = MODID + "."; // public static final String RESOURCE_PREFIX = MODID + ":"; // public static final String DEPENDENCIES = "required-after:Forge@[10.13.2.1291,);after:ThermalExpansion;after:RedstoneArsenal;after:RArm;after:EnderIO@[1.7.10-2.1.3.243,);after:BuildCraft|Core@[6.4.15,7.0.0),[7.0.4,)"; // public static final String GUI_FACTORY = "tonius.simplyjetpacks.config.ConfigGuiFactory"; // // @Instance(MODID) // public static SimplyJetpacks instance; // @SidedProxy(clientSide = "tonius.simplyjetpacks.client.ClientProxy", serverSide = "tonius.simplyjetpacks.CommonProxy") // public static CommonProxy proxy; // public static Logger logger; // public static SyncHandler keyboard; // // @EventHandler // public static void preInit(FMLPreInitializationEvent evt) { // logger = evt.getModLog(); // logger.info("Starting Simply Jetpacks"); // // checkCoFHLib(); // // Packs.preInit(); // Config.preInit(evt); // ModItems.preInit(); // } // // @EventHandler // public static void init(FMLInitializationEvent evt) { // RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped"); // proxy.registerHandlers(); // PacketHandler.init(); // ModItems.init(); // ModEnchantments.init(); // } // // @EventHandler // public static void serverStopping(FMLServerStoppingEvent evt) { // SyncHandler.clearAll(); // } // // private static void checkCoFHLib() { // try { // Class.forName("cofh.lib.util.helpers.FireworksHelper$Explosion"); // logger.info("Successfully found CoFHLib"); // return; // // } catch (ClassNotFoundException e) { // logger.error("Could not find CoFHLib!"); // proxy.throwCoFHLibException(); // } // } // // } // Path: src/main/java/tonius/simplyjetpacks/integration/EIORecipes.java import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import tonius.simplyjetpacks.SimplyJetpacks; import cpw.mods.fml.common.event.FMLInterModComms; package tonius.simplyjetpacks.integration; public abstract class EIORecipes { public static void addAlloySmelterRecipe(String name, int energy, ItemStack primaryInput, ItemStack secondaryInput, ItemStack tertiaryInput, ItemStack output) {
SimplyJetpacks.logger.info("Registering EIO Alloy Smelter recipe");
Tonius/SimplyJetpacks
src/main/java/tonius/simplyjetpacks/integration/TDItems.java
// Path: src/main/java/tonius/simplyjetpacks/SimplyJetpacks.java // @Mod(modid = SimplyJetpacks.MODID, version = SimplyJetpacks.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES, guiFactory = SimplyJetpacks.GUI_FACTORY) // public class SimplyJetpacks { // // public static final String MODID = "simplyjetpacks"; // public static final String VERSION = "@VERSION@"; // public static final String PREFIX = MODID + "."; // public static final String RESOURCE_PREFIX = MODID + ":"; // public static final String DEPENDENCIES = "required-after:Forge@[10.13.2.1291,);after:ThermalExpansion;after:RedstoneArsenal;after:RArm;after:EnderIO@[1.7.10-2.1.3.243,);after:BuildCraft|Core@[6.4.15,7.0.0),[7.0.4,)"; // public static final String GUI_FACTORY = "tonius.simplyjetpacks.config.ConfigGuiFactory"; // // @Instance(MODID) // public static SimplyJetpacks instance; // @SidedProxy(clientSide = "tonius.simplyjetpacks.client.ClientProxy", serverSide = "tonius.simplyjetpacks.CommonProxy") // public static CommonProxy proxy; // public static Logger logger; // public static SyncHandler keyboard; // // @EventHandler // public static void preInit(FMLPreInitializationEvent evt) { // logger = evt.getModLog(); // logger.info("Starting Simply Jetpacks"); // // checkCoFHLib(); // // Packs.preInit(); // Config.preInit(evt); // ModItems.preInit(); // } // // @EventHandler // public static void init(FMLInitializationEvent evt) { // RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped"); // proxy.registerHandlers(); // PacketHandler.init(); // ModItems.init(); // ModEnchantments.init(); // } // // @EventHandler // public static void serverStopping(FMLServerStoppingEvent evt) { // SyncHandler.clearAll(); // } // // private static void checkCoFHLib() { // try { // Class.forName("cofh.lib.util.helpers.FireworksHelper$Explosion"); // logger.info("Successfully found CoFHLib"); // return; // // } catch (ClassNotFoundException e) { // logger.error("Could not find CoFHLib!"); // proxy.throwCoFHLibException(); // } // } // // }
import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import tonius.simplyjetpacks.SimplyJetpacks; import cpw.mods.fml.common.registry.GameRegistry;
package tonius.simplyjetpacks.integration; public abstract class TDItems { public static ItemStack ductFluxLeadstone = null; public static ItemStack ductFluxHardened = null; public static ItemStack ductFluxRedstoneEnergy = null; public static ItemStack ductFluxResonant = null; public static void init() {
// Path: src/main/java/tonius/simplyjetpacks/SimplyJetpacks.java // @Mod(modid = SimplyJetpacks.MODID, version = SimplyJetpacks.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES, guiFactory = SimplyJetpacks.GUI_FACTORY) // public class SimplyJetpacks { // // public static final String MODID = "simplyjetpacks"; // public static final String VERSION = "@VERSION@"; // public static final String PREFIX = MODID + "."; // public static final String RESOURCE_PREFIX = MODID + ":"; // public static final String DEPENDENCIES = "required-after:Forge@[10.13.2.1291,);after:ThermalExpansion;after:RedstoneArsenal;after:RArm;after:EnderIO@[1.7.10-2.1.3.243,);after:BuildCraft|Core@[6.4.15,7.0.0),[7.0.4,)"; // public static final String GUI_FACTORY = "tonius.simplyjetpacks.config.ConfigGuiFactory"; // // @Instance(MODID) // public static SimplyJetpacks instance; // @SidedProxy(clientSide = "tonius.simplyjetpacks.client.ClientProxy", serverSide = "tonius.simplyjetpacks.CommonProxy") // public static CommonProxy proxy; // public static Logger logger; // public static SyncHandler keyboard; // // @EventHandler // public static void preInit(FMLPreInitializationEvent evt) { // logger = evt.getModLog(); // logger.info("Starting Simply Jetpacks"); // // checkCoFHLib(); // // Packs.preInit(); // Config.preInit(evt); // ModItems.preInit(); // } // // @EventHandler // public static void init(FMLInitializationEvent evt) { // RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped"); // proxy.registerHandlers(); // PacketHandler.init(); // ModItems.init(); // ModEnchantments.init(); // } // // @EventHandler // public static void serverStopping(FMLServerStoppingEvent evt) { // SyncHandler.clearAll(); // } // // private static void checkCoFHLib() { // try { // Class.forName("cofh.lib.util.helpers.FireworksHelper$Explosion"); // logger.info("Successfully found CoFHLib"); // return; // // } catch (ClassNotFoundException e) { // logger.error("Could not find CoFHLib!"); // proxy.throwCoFHLibException(); // } // } // // } // Path: src/main/java/tonius/simplyjetpacks/integration/TDItems.java import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import tonius.simplyjetpacks.SimplyJetpacks; import cpw.mods.fml.common.registry.GameRegistry; package tonius.simplyjetpacks.integration; public abstract class TDItems { public static ItemStack ductFluxLeadstone = null; public static ItemStack ductFluxHardened = null; public static ItemStack ductFluxRedstoneEnergy = null; public static ItemStack ductFluxResonant = null; public static void init() {
SimplyJetpacks.logger.info("Stealing Thermal Dynamics's items");
Tonius/SimplyJetpacks
src/main/java/tonius/simplyjetpacks/integration/BCItems.java
// Path: src/main/java/tonius/simplyjetpacks/SimplyJetpacks.java // @Mod(modid = SimplyJetpacks.MODID, version = SimplyJetpacks.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES, guiFactory = SimplyJetpacks.GUI_FACTORY) // public class SimplyJetpacks { // // public static final String MODID = "simplyjetpacks"; // public static final String VERSION = "@VERSION@"; // public static final String PREFIX = MODID + "."; // public static final String RESOURCE_PREFIX = MODID + ":"; // public static final String DEPENDENCIES = "required-after:Forge@[10.13.2.1291,);after:ThermalExpansion;after:RedstoneArsenal;after:RArm;after:EnderIO@[1.7.10-2.1.3.243,);after:BuildCraft|Core@[6.4.15,7.0.0),[7.0.4,)"; // public static final String GUI_FACTORY = "tonius.simplyjetpacks.config.ConfigGuiFactory"; // // @Instance(MODID) // public static SimplyJetpacks instance; // @SidedProxy(clientSide = "tonius.simplyjetpacks.client.ClientProxy", serverSide = "tonius.simplyjetpacks.CommonProxy") // public static CommonProxy proxy; // public static Logger logger; // public static SyncHandler keyboard; // // @EventHandler // public static void preInit(FMLPreInitializationEvent evt) { // logger = evt.getModLog(); // logger.info("Starting Simply Jetpacks"); // // checkCoFHLib(); // // Packs.preInit(); // Config.preInit(evt); // ModItems.preInit(); // } // // @EventHandler // public static void init(FMLInitializationEvent evt) { // RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped"); // proxy.registerHandlers(); // PacketHandler.init(); // ModItems.init(); // ModEnchantments.init(); // } // // @EventHandler // public static void serverStopping(FMLServerStoppingEvent evt) { // SyncHandler.clearAll(); // } // // private static void checkCoFHLib() { // try { // Class.forName("cofh.lib.util.helpers.FireworksHelper$Explosion"); // logger.info("Successfully found CoFHLib"); // return; // // } catch (ClassNotFoundException e) { // logger.error("Could not find CoFHLib!"); // proxy.throwCoFHLibException(); // } // } // // }
import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; import tonius.simplyjetpacks.SimplyJetpacks; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry;
package tonius.simplyjetpacks.integration; public abstract class BCItems { // Transport public static Object pipeFluidStone = null; public static Object pipeEnergyGold = null; // Energy public static Object engineCombustion = null; // Factory public static Object tank = null; // Silicon public static Object chipsetGold = null; public static void init() {
// Path: src/main/java/tonius/simplyjetpacks/SimplyJetpacks.java // @Mod(modid = SimplyJetpacks.MODID, version = SimplyJetpacks.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES, guiFactory = SimplyJetpacks.GUI_FACTORY) // public class SimplyJetpacks { // // public static final String MODID = "simplyjetpacks"; // public static final String VERSION = "@VERSION@"; // public static final String PREFIX = MODID + "."; // public static final String RESOURCE_PREFIX = MODID + ":"; // public static final String DEPENDENCIES = "required-after:Forge@[10.13.2.1291,);after:ThermalExpansion;after:RedstoneArsenal;after:RArm;after:EnderIO@[1.7.10-2.1.3.243,);after:BuildCraft|Core@[6.4.15,7.0.0),[7.0.4,)"; // public static final String GUI_FACTORY = "tonius.simplyjetpacks.config.ConfigGuiFactory"; // // @Instance(MODID) // public static SimplyJetpacks instance; // @SidedProxy(clientSide = "tonius.simplyjetpacks.client.ClientProxy", serverSide = "tonius.simplyjetpacks.CommonProxy") // public static CommonProxy proxy; // public static Logger logger; // public static SyncHandler keyboard; // // @EventHandler // public static void preInit(FMLPreInitializationEvent evt) { // logger = evt.getModLog(); // logger.info("Starting Simply Jetpacks"); // // checkCoFHLib(); // // Packs.preInit(); // Config.preInit(evt); // ModItems.preInit(); // } // // @EventHandler // public static void init(FMLInitializationEvent evt) { // RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped"); // proxy.registerHandlers(); // PacketHandler.init(); // ModItems.init(); // ModEnchantments.init(); // } // // @EventHandler // public static void serverStopping(FMLServerStoppingEvent evt) { // SyncHandler.clearAll(); // } // // private static void checkCoFHLib() { // try { // Class.forName("cofh.lib.util.helpers.FireworksHelper$Explosion"); // logger.info("Successfully found CoFHLib"); // return; // // } catch (ClassNotFoundException e) { // logger.error("Could not find CoFHLib!"); // proxy.throwCoFHLibException(); // } // } // // } // Path: src/main/java/tonius/simplyjetpacks/integration/BCItems.java import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; import tonius.simplyjetpacks.SimplyJetpacks; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; package tonius.simplyjetpacks.integration; public abstract class BCItems { // Transport public static Object pipeFluidStone = null; public static Object pipeEnergyGold = null; // Energy public static Object engineCombustion = null; // Factory public static Object tank = null; // Silicon public static Object chipsetGold = null; public static void init() {
SimplyJetpacks.logger.info("Stealing BuildCraft's items");
Tonius/SimplyJetpacks
src/main/java/tonius/simplyjetpacks/integration/BCRecipes.java
// Path: src/main/java/tonius/simplyjetpacks/SimplyJetpacks.java // @Mod(modid = SimplyJetpacks.MODID, version = SimplyJetpacks.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES, guiFactory = SimplyJetpacks.GUI_FACTORY) // public class SimplyJetpacks { // // public static final String MODID = "simplyjetpacks"; // public static final String VERSION = "@VERSION@"; // public static final String PREFIX = MODID + "."; // public static final String RESOURCE_PREFIX = MODID + ":"; // public static final String DEPENDENCIES = "required-after:Forge@[10.13.2.1291,);after:ThermalExpansion;after:RedstoneArsenal;after:RArm;after:EnderIO@[1.7.10-2.1.3.243,);after:BuildCraft|Core@[6.4.15,7.0.0),[7.0.4,)"; // public static final String GUI_FACTORY = "tonius.simplyjetpacks.config.ConfigGuiFactory"; // // @Instance(MODID) // public static SimplyJetpacks instance; // @SidedProxy(clientSide = "tonius.simplyjetpacks.client.ClientProxy", serverSide = "tonius.simplyjetpacks.CommonProxy") // public static CommonProxy proxy; // public static Logger logger; // public static SyncHandler keyboard; // // @EventHandler // public static void preInit(FMLPreInitializationEvent evt) { // logger = evt.getModLog(); // logger.info("Starting Simply Jetpacks"); // // checkCoFHLib(); // // Packs.preInit(); // Config.preInit(evt); // ModItems.preInit(); // } // // @EventHandler // public static void init(FMLInitializationEvent evt) { // RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped"); // proxy.registerHandlers(); // PacketHandler.init(); // ModItems.init(); // ModEnchantments.init(); // } // // @EventHandler // public static void serverStopping(FMLServerStoppingEvent evt) { // SyncHandler.clearAll(); // } // // private static void checkCoFHLib() { // try { // Class.forName("cofh.lib.util.helpers.FireworksHelper$Explosion"); // logger.info("Successfully found CoFHLib"); // return; // // } catch (ClassNotFoundException e) { // logger.error("Could not find CoFHLib!"); // proxy.throwCoFHLibException(); // } // } // // }
import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import tonius.simplyjetpacks.SimplyJetpacks; import cpw.mods.fml.common.event.FMLInterModComms;
package tonius.simplyjetpacks.integration; public abstract class BCRecipes { public static void addAssemblyRecipe(String recipeId, int energy, ItemStack[] inputs, ItemStack output) {
// Path: src/main/java/tonius/simplyjetpacks/SimplyJetpacks.java // @Mod(modid = SimplyJetpacks.MODID, version = SimplyJetpacks.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES, guiFactory = SimplyJetpacks.GUI_FACTORY) // public class SimplyJetpacks { // // public static final String MODID = "simplyjetpacks"; // public static final String VERSION = "@VERSION@"; // public static final String PREFIX = MODID + "."; // public static final String RESOURCE_PREFIX = MODID + ":"; // public static final String DEPENDENCIES = "required-after:Forge@[10.13.2.1291,);after:ThermalExpansion;after:RedstoneArsenal;after:RArm;after:EnderIO@[1.7.10-2.1.3.243,);after:BuildCraft|Core@[6.4.15,7.0.0),[7.0.4,)"; // public static final String GUI_FACTORY = "tonius.simplyjetpacks.config.ConfigGuiFactory"; // // @Instance(MODID) // public static SimplyJetpacks instance; // @SidedProxy(clientSide = "tonius.simplyjetpacks.client.ClientProxy", serverSide = "tonius.simplyjetpacks.CommonProxy") // public static CommonProxy proxy; // public static Logger logger; // public static SyncHandler keyboard; // // @EventHandler // public static void preInit(FMLPreInitializationEvent evt) { // logger = evt.getModLog(); // logger.info("Starting Simply Jetpacks"); // // checkCoFHLib(); // // Packs.preInit(); // Config.preInit(evt); // ModItems.preInit(); // } // // @EventHandler // public static void init(FMLInitializationEvent evt) { // RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped"); // proxy.registerHandlers(); // PacketHandler.init(); // ModItems.init(); // ModEnchantments.init(); // } // // @EventHandler // public static void serverStopping(FMLServerStoppingEvent evt) { // SyncHandler.clearAll(); // } // // private static void checkCoFHLib() { // try { // Class.forName("cofh.lib.util.helpers.FireworksHelper$Explosion"); // logger.info("Successfully found CoFHLib"); // return; // // } catch (ClassNotFoundException e) { // logger.error("Could not find CoFHLib!"); // proxy.throwCoFHLibException(); // } // } // // } // Path: src/main/java/tonius/simplyjetpacks/integration/BCRecipes.java import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import tonius.simplyjetpacks.SimplyJetpacks; import cpw.mods.fml.common.event.FMLInterModComms; package tonius.simplyjetpacks.integration; public abstract class BCRecipes { public static void addAssemblyRecipe(String recipeId, int energy, ItemStack[] inputs, ItemStack output) {
SimplyJetpacks.logger.info("Registering BC Assembly Table recipe");
Tonius/SimplyJetpacks
src/main/java/tonius/simplyjetpacks/handler/EntityInteractHandler.java
// Path: src/main/java/tonius/simplyjetpacks/item/ItemPack.java // public static class ItemJetpack extends ItemPack<Jetpack> { // // public ItemJetpack(ModType modType, String registryName) { // super(modType, registryName); // } // // }
import net.minecraft.entity.EntityLiving; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.item.ItemStack; import net.minecraftforge.event.entity.player.EntityInteractEvent; import tonius.simplyjetpacks.item.ItemPack.ItemJetpack; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
package tonius.simplyjetpacks.handler; public class EntityInteractHandler { @SubscribeEvent public void onEntityInteract(EntityInteractEvent evt) { if (evt.entityPlayer.isSneaking() && (evt.target instanceof EntityZombie || evt.target instanceof EntitySkeleton)) { EntityLiving target = (EntityLiving) evt.target; ItemStack heldStack = evt.entityPlayer.getHeldItem();
// Path: src/main/java/tonius/simplyjetpacks/item/ItemPack.java // public static class ItemJetpack extends ItemPack<Jetpack> { // // public ItemJetpack(ModType modType, String registryName) { // super(modType, registryName); // } // // } // Path: src/main/java/tonius/simplyjetpacks/handler/EntityInteractHandler.java import net.minecraft.entity.EntityLiving; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.item.ItemStack; import net.minecraftforge.event.entity.player.EntityInteractEvent; import tonius.simplyjetpacks.item.ItemPack.ItemJetpack; import cpw.mods.fml.common.eventhandler.SubscribeEvent; package tonius.simplyjetpacks.handler; public class EntityInteractHandler { @SubscribeEvent public void onEntityInteract(EntityInteractEvent evt) { if (evt.entityPlayer.isSneaking() && (evt.target instanceof EntityZombie || evt.target instanceof EntitySkeleton)) { EntityLiving target = (EntityLiving) evt.target; ItemStack heldStack = evt.entityPlayer.getHeldItem();
if (heldStack != null && heldStack.getItem() instanceof ItemJetpack) {
Tonius/SimplyJetpacks
src/main/java/tonius/simplyjetpacks/network/message/MessageKeyboardSync.java
// Path: src/main/java/tonius/simplyjetpacks/handler/SyncHandler.java // public class SyncHandler { // // private static final Map<EntityPlayer, Boolean> flyKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> descendKeyState = new HashMap<EntityPlayer, Boolean>(); // // private static final Map<EntityPlayer, Boolean> forwardKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> backwardKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> leftKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> rightKeyState = new HashMap<EntityPlayer, Boolean>(); // // private static final Map<Integer, ParticleType> jetpackState = new HashMap<Integer, ParticleType>(); // // public static boolean isFlyKeyDown(EntityLivingBase user) { // return !(user instanceof EntityPlayer) || flyKeyState.containsKey(user) && flyKeyState.get(user); // } // // public static boolean isDescendKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && descendKeyState.containsKey(user) && descendKeyState.get(user); // } // // public static boolean isForwardKeyDown(EntityLivingBase user) { // return !(user instanceof EntityPlayer) || forwardKeyState.containsKey(user) && forwardKeyState.get(user); // } // // public static boolean isBackwardKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && backwardKeyState.containsKey(user) && backwardKeyState.get(user); // } // // public static boolean isLeftKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && leftKeyState.containsKey(user) && leftKeyState.get(user); // } // // public static boolean isRightKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && rightKeyState.containsKey(user) && rightKeyState.get(user); // } // // public static void processKeyUpdate(EntityPlayer player, boolean keyFly, boolean keyDescend, boolean keyForward, boolean keyBackward, boolean keyLeft, boolean keyRight) { // flyKeyState.put(player, keyFly); // descendKeyState.put(player, keyDescend); // // forwardKeyState.put(player, keyForward); // backwardKeyState.put(player, keyBackward); // leftKeyState.put(player, keyLeft); // rightKeyState.put(player, keyRight); // } // // public static void processJetpackUpdate(int entityId, ParticleType particleType) { // if (particleType != null) { // jetpackState.put(entityId, particleType); // } else { // jetpackState.remove(entityId); // } // } // // public static Map<Integer, ParticleType> getJetpackStates() { // return jetpackState; // } // // public static void clearAll() { // flyKeyState.clear(); // forwardKeyState.clear(); // backwardKeyState.clear(); // leftKeyState.clear(); // rightKeyState.clear(); // } // // private static void removeFromAll(EntityPlayer player) { // flyKeyState.remove(player); // forwardKeyState.remove(player); // backwardKeyState.remove(player); // leftKeyState.remove(player); // rightKeyState.remove(player); // } // // @SubscribeEvent // public void onPlayerLoggedIn(PlayerLoggedInEvent evt) { // PacketHandler.instance.sendTo(new MessageConfigSync(), (EntityPlayerMP) evt.player); // } // // @SubscribeEvent // public void onPlayerLoggedOut(PlayerLoggedOutEvent evt) { // removeFromAll(evt.player); // } // // @SubscribeEvent // public void onDimChanged(PlayerChangedDimensionEvent evt) { // removeFromAll(evt.player); // } // // @SubscribeEvent // public void onClientDisconnectedFromServer(ClientDisconnectionFromServerEvent evt) { // SoundJetpack.clearPlayingFor(); // Config.onConfigChanged(SimplyJetpacks.MODID); // } // // }
import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import tonius.simplyjetpacks.handler.SyncHandler; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext;
this.leftState = leftState; this.rightState = rightState; } @Override public void fromBytes(ByteBuf buf) { this.flyState = buf.readBoolean(); this.descendState = buf.readBoolean(); this.forwardState = buf.readBoolean(); this.backwardState = buf.readBoolean(); this.leftState = buf.readBoolean(); this.rightState = buf.readBoolean(); } @Override public void toBytes(ByteBuf buf) { buf.writeBoolean(this.flyState); buf.writeBoolean(this.descendState); buf.writeBoolean(this.forwardState); buf.writeBoolean(this.backwardState); buf.writeBoolean(this.leftState); buf.writeBoolean(this.rightState); } @Override public IMessage onMessage(MessageKeyboardSync msg, MessageContext ctx) { EntityPlayer entityPlayer = ctx.getServerHandler().playerEntity; if (entityPlayer != null) {
// Path: src/main/java/tonius/simplyjetpacks/handler/SyncHandler.java // public class SyncHandler { // // private static final Map<EntityPlayer, Boolean> flyKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> descendKeyState = new HashMap<EntityPlayer, Boolean>(); // // private static final Map<EntityPlayer, Boolean> forwardKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> backwardKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> leftKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> rightKeyState = new HashMap<EntityPlayer, Boolean>(); // // private static final Map<Integer, ParticleType> jetpackState = new HashMap<Integer, ParticleType>(); // // public static boolean isFlyKeyDown(EntityLivingBase user) { // return !(user instanceof EntityPlayer) || flyKeyState.containsKey(user) && flyKeyState.get(user); // } // // public static boolean isDescendKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && descendKeyState.containsKey(user) && descendKeyState.get(user); // } // // public static boolean isForwardKeyDown(EntityLivingBase user) { // return !(user instanceof EntityPlayer) || forwardKeyState.containsKey(user) && forwardKeyState.get(user); // } // // public static boolean isBackwardKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && backwardKeyState.containsKey(user) && backwardKeyState.get(user); // } // // public static boolean isLeftKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && leftKeyState.containsKey(user) && leftKeyState.get(user); // } // // public static boolean isRightKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && rightKeyState.containsKey(user) && rightKeyState.get(user); // } // // public static void processKeyUpdate(EntityPlayer player, boolean keyFly, boolean keyDescend, boolean keyForward, boolean keyBackward, boolean keyLeft, boolean keyRight) { // flyKeyState.put(player, keyFly); // descendKeyState.put(player, keyDescend); // // forwardKeyState.put(player, keyForward); // backwardKeyState.put(player, keyBackward); // leftKeyState.put(player, keyLeft); // rightKeyState.put(player, keyRight); // } // // public static void processJetpackUpdate(int entityId, ParticleType particleType) { // if (particleType != null) { // jetpackState.put(entityId, particleType); // } else { // jetpackState.remove(entityId); // } // } // // public static Map<Integer, ParticleType> getJetpackStates() { // return jetpackState; // } // // public static void clearAll() { // flyKeyState.clear(); // forwardKeyState.clear(); // backwardKeyState.clear(); // leftKeyState.clear(); // rightKeyState.clear(); // } // // private static void removeFromAll(EntityPlayer player) { // flyKeyState.remove(player); // forwardKeyState.remove(player); // backwardKeyState.remove(player); // leftKeyState.remove(player); // rightKeyState.remove(player); // } // // @SubscribeEvent // public void onPlayerLoggedIn(PlayerLoggedInEvent evt) { // PacketHandler.instance.sendTo(new MessageConfigSync(), (EntityPlayerMP) evt.player); // } // // @SubscribeEvent // public void onPlayerLoggedOut(PlayerLoggedOutEvent evt) { // removeFromAll(evt.player); // } // // @SubscribeEvent // public void onDimChanged(PlayerChangedDimensionEvent evt) { // removeFromAll(evt.player); // } // // @SubscribeEvent // public void onClientDisconnectedFromServer(ClientDisconnectionFromServerEvent evt) { // SoundJetpack.clearPlayingFor(); // Config.onConfigChanged(SimplyJetpacks.MODID); // } // // } // Path: src/main/java/tonius/simplyjetpacks/network/message/MessageKeyboardSync.java import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import tonius.simplyjetpacks.handler.SyncHandler; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; this.leftState = leftState; this.rightState = rightState; } @Override public void fromBytes(ByteBuf buf) { this.flyState = buf.readBoolean(); this.descendState = buf.readBoolean(); this.forwardState = buf.readBoolean(); this.backwardState = buf.readBoolean(); this.leftState = buf.readBoolean(); this.rightState = buf.readBoolean(); } @Override public void toBytes(ByteBuf buf) { buf.writeBoolean(this.flyState); buf.writeBoolean(this.descendState); buf.writeBoolean(this.forwardState); buf.writeBoolean(this.backwardState); buf.writeBoolean(this.leftState); buf.writeBoolean(this.rightState); } @Override public IMessage onMessage(MessageKeyboardSync msg, MessageContext ctx) { EntityPlayer entityPlayer = ctx.getServerHandler().playerEntity; if (entityPlayer != null) {
SyncHandler.processKeyUpdate(entityPlayer, msg.flyState, msg.descendState, msg.forwardState, msg.backwardState, msg.leftState, msg.rightState);
Tonius/SimplyJetpacks
src/main/java/tonius/simplyjetpacks/config/Defaults.java
// Path: src/main/java/tonius/simplyjetpacks/client/util/RenderUtils.java // public enum HUDPositions { // TOP_LEFT, // TOP_CENTER, // TOP_RIGHT, // LEFT, // RIGHT, // BOTTOM_LEFT, // BOTTOM_RIGHT // } // // Path: src/main/java/tonius/simplyjetpacks/integration/ModType.java // public enum ModType { // // SIMPLY_JETPACKS("", SimplyJetpacks.MODID), // THERMAL_EXPANSION(".te", "ThermalExpansion"), // THERMAL_DYNAMICS(null, "ThermalDynamics"), // REDSTONE_ARSENAL(null, "RedstoneArsenal"), // REDSTONE_ARMORY(null, "RArm"), // ENDER_IO(".eio", "EnderIO"), // BUILDCRAFT(".bc", "BuildCraft|Core"); // // public final String suffix; // public final String[] modids; // public final boolean loaded; // // private ModType(String suffix, String... modids) { // this.suffix = suffix; // this.modids = modids; // // for (String s : this.modids) { // if (!Loader.isModLoaded(s)) { // this.loaded = false; // return; // } // } // this.loaded = true; // } // // }
import tonius.simplyjetpacks.client.util.RenderUtils.HUDPositions; import tonius.simplyjetpacks.integration.ModType;
package tonius.simplyjetpacks.config; public abstract class Defaults { // item public static final int enchantFuelEfficiencyID = 110; public static final boolean flammableFluidsExplode = false; public static final boolean addRAItemsIfNotInstalled = true; // integration
// Path: src/main/java/tonius/simplyjetpacks/client/util/RenderUtils.java // public enum HUDPositions { // TOP_LEFT, // TOP_CENTER, // TOP_RIGHT, // LEFT, // RIGHT, // BOTTOM_LEFT, // BOTTOM_RIGHT // } // // Path: src/main/java/tonius/simplyjetpacks/integration/ModType.java // public enum ModType { // // SIMPLY_JETPACKS("", SimplyJetpacks.MODID), // THERMAL_EXPANSION(".te", "ThermalExpansion"), // THERMAL_DYNAMICS(null, "ThermalDynamics"), // REDSTONE_ARSENAL(null, "RedstoneArsenal"), // REDSTONE_ARMORY(null, "RArm"), // ENDER_IO(".eio", "EnderIO"), // BUILDCRAFT(".bc", "BuildCraft|Core"); // // public final String suffix; // public final String[] modids; // public final boolean loaded; // // private ModType(String suffix, String... modids) { // this.suffix = suffix; // this.modids = modids; // // for (String s : this.modids) { // if (!Loader.isModLoaded(s)) { // this.loaded = false; // return; // } // } // this.loaded = true; // } // // } // Path: src/main/java/tonius/simplyjetpacks/config/Defaults.java import tonius.simplyjetpacks.client.util.RenderUtils.HUDPositions; import tonius.simplyjetpacks.integration.ModType; package tonius.simplyjetpacks.config; public abstract class Defaults { // item public static final int enchantFuelEfficiencyID = 110; public static final boolean flammableFluidsExplode = false; public static final boolean addRAItemsIfNotInstalled = true; // integration
public static final boolean enableIntegrationTE = ModType.THERMAL_EXPANSION.loaded;
Tonius/SimplyJetpacks
src/main/java/tonius/simplyjetpacks/config/Defaults.java
// Path: src/main/java/tonius/simplyjetpacks/client/util/RenderUtils.java // public enum HUDPositions { // TOP_LEFT, // TOP_CENTER, // TOP_RIGHT, // LEFT, // RIGHT, // BOTTOM_LEFT, // BOTTOM_RIGHT // } // // Path: src/main/java/tonius/simplyjetpacks/integration/ModType.java // public enum ModType { // // SIMPLY_JETPACKS("", SimplyJetpacks.MODID), // THERMAL_EXPANSION(".te", "ThermalExpansion"), // THERMAL_DYNAMICS(null, "ThermalDynamics"), // REDSTONE_ARSENAL(null, "RedstoneArsenal"), // REDSTONE_ARMORY(null, "RArm"), // ENDER_IO(".eio", "EnderIO"), // BUILDCRAFT(".bc", "BuildCraft|Core"); // // public final String suffix; // public final String[] modids; // public final boolean loaded; // // private ModType(String suffix, String... modids) { // this.suffix = suffix; // this.modids = modids; // // for (String s : this.modids) { // if (!Loader.isModLoaded(s)) { // this.loaded = false; // return; // } // } // this.loaded = true; // } // // }
import tonius.simplyjetpacks.client.util.RenderUtils.HUDPositions; import tonius.simplyjetpacks.integration.ModType;
package tonius.simplyjetpacks.config; public abstract class Defaults { // item public static final int enchantFuelEfficiencyID = 110; public static final boolean flammableFluidsExplode = false; public static final boolean addRAItemsIfNotInstalled = true; // integration public static final boolean enableIntegrationTE = ModType.THERMAL_EXPANSION.loaded; public static final boolean enableIntegrationEIO = ModType.ENDER_IO.loaded && !enableIntegrationTE; public static final boolean enableIntegrationBC = ModType.BUILDCRAFT.loaded && !enableIntegrationTE && !enableIntegrationEIO; // controls public static final boolean customControls = false; public static final String flyKey = "SPACE"; public static final String descendKey = "LSHIFT"; public static final boolean invertHoverSneakingBehavior = false; public static final boolean doubleTapSprintInAir = true; // aesthetics public static final boolean enableArmor3DModels = true; // sounds public static final boolean jetpackSounds = true; // gui public static final boolean holdShiftForDetails = true;
// Path: src/main/java/tonius/simplyjetpacks/client/util/RenderUtils.java // public enum HUDPositions { // TOP_LEFT, // TOP_CENTER, // TOP_RIGHT, // LEFT, // RIGHT, // BOTTOM_LEFT, // BOTTOM_RIGHT // } // // Path: src/main/java/tonius/simplyjetpacks/integration/ModType.java // public enum ModType { // // SIMPLY_JETPACKS("", SimplyJetpacks.MODID), // THERMAL_EXPANSION(".te", "ThermalExpansion"), // THERMAL_DYNAMICS(null, "ThermalDynamics"), // REDSTONE_ARSENAL(null, "RedstoneArsenal"), // REDSTONE_ARMORY(null, "RArm"), // ENDER_IO(".eio", "EnderIO"), // BUILDCRAFT(".bc", "BuildCraft|Core"); // // public final String suffix; // public final String[] modids; // public final boolean loaded; // // private ModType(String suffix, String... modids) { // this.suffix = suffix; // this.modids = modids; // // for (String s : this.modids) { // if (!Loader.isModLoaded(s)) { // this.loaded = false; // return; // } // } // this.loaded = true; // } // // } // Path: src/main/java/tonius/simplyjetpacks/config/Defaults.java import tonius.simplyjetpacks.client.util.RenderUtils.HUDPositions; import tonius.simplyjetpacks.integration.ModType; package tonius.simplyjetpacks.config; public abstract class Defaults { // item public static final int enchantFuelEfficiencyID = 110; public static final boolean flammableFluidsExplode = false; public static final boolean addRAItemsIfNotInstalled = true; // integration public static final boolean enableIntegrationTE = ModType.THERMAL_EXPANSION.loaded; public static final boolean enableIntegrationEIO = ModType.ENDER_IO.loaded && !enableIntegrationTE; public static final boolean enableIntegrationBC = ModType.BUILDCRAFT.loaded && !enableIntegrationTE && !enableIntegrationEIO; // controls public static final boolean customControls = false; public static final String flyKey = "SPACE"; public static final String descendKey = "LSHIFT"; public static final boolean invertHoverSneakingBehavior = false; public static final boolean doubleTapSprintInAir = true; // aesthetics public static final boolean enableArmor3DModels = true; // sounds public static final boolean jetpackSounds = true; // gui public static final boolean holdShiftForDetails = true;
public static final int HUDPosition = HUDPositions.TOP_LEFT.ordinal();
Tonius/SimplyJetpacks
src/main/java/tonius/simplyjetpacks/integration/EIOItems.java
// Path: src/main/java/tonius/simplyjetpacks/SimplyJetpacks.java // @Mod(modid = SimplyJetpacks.MODID, version = SimplyJetpacks.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES, guiFactory = SimplyJetpacks.GUI_FACTORY) // public class SimplyJetpacks { // // public static final String MODID = "simplyjetpacks"; // public static final String VERSION = "@VERSION@"; // public static final String PREFIX = MODID + "."; // public static final String RESOURCE_PREFIX = MODID + ":"; // public static final String DEPENDENCIES = "required-after:Forge@[10.13.2.1291,);after:ThermalExpansion;after:RedstoneArsenal;after:RArm;after:EnderIO@[1.7.10-2.1.3.243,);after:BuildCraft|Core@[6.4.15,7.0.0),[7.0.4,)"; // public static final String GUI_FACTORY = "tonius.simplyjetpacks.config.ConfigGuiFactory"; // // @Instance(MODID) // public static SimplyJetpacks instance; // @SidedProxy(clientSide = "tonius.simplyjetpacks.client.ClientProxy", serverSide = "tonius.simplyjetpacks.CommonProxy") // public static CommonProxy proxy; // public static Logger logger; // public static SyncHandler keyboard; // // @EventHandler // public static void preInit(FMLPreInitializationEvent evt) { // logger = evt.getModLog(); // logger.info("Starting Simply Jetpacks"); // // checkCoFHLib(); // // Packs.preInit(); // Config.preInit(evt); // ModItems.preInit(); // } // // @EventHandler // public static void init(FMLInitializationEvent evt) { // RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped"); // proxy.registerHandlers(); // PacketHandler.init(); // ModItems.init(); // ModEnchantments.init(); // } // // @EventHandler // public static void serverStopping(FMLServerStoppingEvent evt) { // SyncHandler.clearAll(); // } // // private static void checkCoFHLib() { // try { // Class.forName("cofh.lib.util.helpers.FireworksHelper$Explosion"); // logger.info("Successfully found CoFHLib"); // return; // // } catch (ClassNotFoundException e) { // logger.error("Could not find CoFHLib!"); // proxy.throwCoFHLibException(); // } // } // // }
import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import tonius.simplyjetpacks.SimplyJetpacks; import cpw.mods.fml.common.registry.GameRegistry;
package tonius.simplyjetpacks.integration; public abstract class EIOItems { public static ItemStack capacitorBankOld; public static ItemStack capacitorBank; public static ItemStack capacitorBankVibrant; public static ItemStack redstoneConduit; public static ItemStack energyConduit1; public static ItemStack energyConduit2; public static ItemStack energyConduit3; public static ItemStack basicCapacitor; public static ItemStack doubleCapacitor; public static ItemStack octadicCapacitor; public static ItemStack machineChassis; public static ItemStack basicGear; public static ItemStack pulsatingCrystal; public static ItemStack vibrantCrystal; public static ItemStack enderCrystal; public static void init() {
// Path: src/main/java/tonius/simplyjetpacks/SimplyJetpacks.java // @Mod(modid = SimplyJetpacks.MODID, version = SimplyJetpacks.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES, guiFactory = SimplyJetpacks.GUI_FACTORY) // public class SimplyJetpacks { // // public static final String MODID = "simplyjetpacks"; // public static final String VERSION = "@VERSION@"; // public static final String PREFIX = MODID + "."; // public static final String RESOURCE_PREFIX = MODID + ":"; // public static final String DEPENDENCIES = "required-after:Forge@[10.13.2.1291,);after:ThermalExpansion;after:RedstoneArsenal;after:RArm;after:EnderIO@[1.7.10-2.1.3.243,);after:BuildCraft|Core@[6.4.15,7.0.0),[7.0.4,)"; // public static final String GUI_FACTORY = "tonius.simplyjetpacks.config.ConfigGuiFactory"; // // @Instance(MODID) // public static SimplyJetpacks instance; // @SidedProxy(clientSide = "tonius.simplyjetpacks.client.ClientProxy", serverSide = "tonius.simplyjetpacks.CommonProxy") // public static CommonProxy proxy; // public static Logger logger; // public static SyncHandler keyboard; // // @EventHandler // public static void preInit(FMLPreInitializationEvent evt) { // logger = evt.getModLog(); // logger.info("Starting Simply Jetpacks"); // // checkCoFHLib(); // // Packs.preInit(); // Config.preInit(evt); // ModItems.preInit(); // } // // @EventHandler // public static void init(FMLInitializationEvent evt) { // RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped"); // proxy.registerHandlers(); // PacketHandler.init(); // ModItems.init(); // ModEnchantments.init(); // } // // @EventHandler // public static void serverStopping(FMLServerStoppingEvent evt) { // SyncHandler.clearAll(); // } // // private static void checkCoFHLib() { // try { // Class.forName("cofh.lib.util.helpers.FireworksHelper$Explosion"); // logger.info("Successfully found CoFHLib"); // return; // // } catch (ClassNotFoundException e) { // logger.error("Could not find CoFHLib!"); // proxy.throwCoFHLibException(); // } // } // // } // Path: src/main/java/tonius/simplyjetpacks/integration/EIOItems.java import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import tonius.simplyjetpacks.SimplyJetpacks; import cpw.mods.fml.common.registry.GameRegistry; package tonius.simplyjetpacks.integration; public abstract class EIOItems { public static ItemStack capacitorBankOld; public static ItemStack capacitorBank; public static ItemStack capacitorBankVibrant; public static ItemStack redstoneConduit; public static ItemStack energyConduit1; public static ItemStack energyConduit2; public static ItemStack energyConduit3; public static ItemStack basicCapacitor; public static ItemStack doubleCapacitor; public static ItemStack octadicCapacitor; public static ItemStack machineChassis; public static ItemStack basicGear; public static ItemStack pulsatingCrystal; public static ItemStack vibrantCrystal; public static ItemStack enderCrystal; public static void init() {
SimplyJetpacks.logger.info("Stealing Ender IO's items");
Tonius/SimplyJetpacks
src/main/java/tonius/simplyjetpacks/integration/TERecipes.java
// Path: src/main/java/tonius/simplyjetpacks/SimplyJetpacks.java // @Mod(modid = SimplyJetpacks.MODID, version = SimplyJetpacks.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES, guiFactory = SimplyJetpacks.GUI_FACTORY) // public class SimplyJetpacks { // // public static final String MODID = "simplyjetpacks"; // public static final String VERSION = "@VERSION@"; // public static final String PREFIX = MODID + "."; // public static final String RESOURCE_PREFIX = MODID + ":"; // public static final String DEPENDENCIES = "required-after:Forge@[10.13.2.1291,);after:ThermalExpansion;after:RedstoneArsenal;after:RArm;after:EnderIO@[1.7.10-2.1.3.243,);after:BuildCraft|Core@[6.4.15,7.0.0),[7.0.4,)"; // public static final String GUI_FACTORY = "tonius.simplyjetpacks.config.ConfigGuiFactory"; // // @Instance(MODID) // public static SimplyJetpacks instance; // @SidedProxy(clientSide = "tonius.simplyjetpacks.client.ClientProxy", serverSide = "tonius.simplyjetpacks.CommonProxy") // public static CommonProxy proxy; // public static Logger logger; // public static SyncHandler keyboard; // // @EventHandler // public static void preInit(FMLPreInitializationEvent evt) { // logger = evt.getModLog(); // logger.info("Starting Simply Jetpacks"); // // checkCoFHLib(); // // Packs.preInit(); // Config.preInit(evt); // ModItems.preInit(); // } // // @EventHandler // public static void init(FMLInitializationEvent evt) { // RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped"); // proxy.registerHandlers(); // PacketHandler.init(); // ModItems.init(); // ModEnchantments.init(); // } // // @EventHandler // public static void serverStopping(FMLServerStoppingEvent evt) { // SyncHandler.clearAll(); // } // // private static void checkCoFHLib() { // try { // Class.forName("cofh.lib.util.helpers.FireworksHelper$Explosion"); // logger.info("Successfully found CoFHLib"); // return; // // } catch (ClassNotFoundException e) { // logger.error("Could not find CoFHLib!"); // proxy.throwCoFHLibException(); // } // } // // }
import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; import tonius.simplyjetpacks.SimplyJetpacks; import cpw.mods.fml.common.event.FMLInterModComms;
package tonius.simplyjetpacks.integration; public abstract class TERecipes { public static void addSmelterRecipe(int energy, ItemStack primaryInput, ItemStack secondaryInput, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance) {
// Path: src/main/java/tonius/simplyjetpacks/SimplyJetpacks.java // @Mod(modid = SimplyJetpacks.MODID, version = SimplyJetpacks.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES, guiFactory = SimplyJetpacks.GUI_FACTORY) // public class SimplyJetpacks { // // public static final String MODID = "simplyjetpacks"; // public static final String VERSION = "@VERSION@"; // public static final String PREFIX = MODID + "."; // public static final String RESOURCE_PREFIX = MODID + ":"; // public static final String DEPENDENCIES = "required-after:Forge@[10.13.2.1291,);after:ThermalExpansion;after:RedstoneArsenal;after:RArm;after:EnderIO@[1.7.10-2.1.3.243,);after:BuildCraft|Core@[6.4.15,7.0.0),[7.0.4,)"; // public static final String GUI_FACTORY = "tonius.simplyjetpacks.config.ConfigGuiFactory"; // // @Instance(MODID) // public static SimplyJetpacks instance; // @SidedProxy(clientSide = "tonius.simplyjetpacks.client.ClientProxy", serverSide = "tonius.simplyjetpacks.CommonProxy") // public static CommonProxy proxy; // public static Logger logger; // public static SyncHandler keyboard; // // @EventHandler // public static void preInit(FMLPreInitializationEvent evt) { // logger = evt.getModLog(); // logger.info("Starting Simply Jetpacks"); // // checkCoFHLib(); // // Packs.preInit(); // Config.preInit(evt); // ModItems.preInit(); // } // // @EventHandler // public static void init(FMLInitializationEvent evt) { // RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped"); // proxy.registerHandlers(); // PacketHandler.init(); // ModItems.init(); // ModEnchantments.init(); // } // // @EventHandler // public static void serverStopping(FMLServerStoppingEvent evt) { // SyncHandler.clearAll(); // } // // private static void checkCoFHLib() { // try { // Class.forName("cofh.lib.util.helpers.FireworksHelper$Explosion"); // logger.info("Successfully found CoFHLib"); // return; // // } catch (ClassNotFoundException e) { // logger.error("Could not find CoFHLib!"); // proxy.throwCoFHLibException(); // } // } // // } // Path: src/main/java/tonius/simplyjetpacks/integration/TERecipes.java import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; import tonius.simplyjetpacks.SimplyJetpacks; import cpw.mods.fml.common.event.FMLInterModComms; package tonius.simplyjetpacks.integration; public abstract class TERecipes { public static void addSmelterRecipe(int energy, ItemStack primaryInput, ItemStack secondaryInput, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance) {
SimplyJetpacks.logger.info("Registering TE Induction Smelter recipe");
Tonius/SimplyJetpacks
src/main/java/tonius/simplyjetpacks/network/message/MessageJetpackSync.java
// Path: src/main/java/tonius/simplyjetpacks/handler/SyncHandler.java // public class SyncHandler { // // private static final Map<EntityPlayer, Boolean> flyKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> descendKeyState = new HashMap<EntityPlayer, Boolean>(); // // private static final Map<EntityPlayer, Boolean> forwardKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> backwardKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> leftKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> rightKeyState = new HashMap<EntityPlayer, Boolean>(); // // private static final Map<Integer, ParticleType> jetpackState = new HashMap<Integer, ParticleType>(); // // public static boolean isFlyKeyDown(EntityLivingBase user) { // return !(user instanceof EntityPlayer) || flyKeyState.containsKey(user) && flyKeyState.get(user); // } // // public static boolean isDescendKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && descendKeyState.containsKey(user) && descendKeyState.get(user); // } // // public static boolean isForwardKeyDown(EntityLivingBase user) { // return !(user instanceof EntityPlayer) || forwardKeyState.containsKey(user) && forwardKeyState.get(user); // } // // public static boolean isBackwardKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && backwardKeyState.containsKey(user) && backwardKeyState.get(user); // } // // public static boolean isLeftKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && leftKeyState.containsKey(user) && leftKeyState.get(user); // } // // public static boolean isRightKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && rightKeyState.containsKey(user) && rightKeyState.get(user); // } // // public static void processKeyUpdate(EntityPlayer player, boolean keyFly, boolean keyDescend, boolean keyForward, boolean keyBackward, boolean keyLeft, boolean keyRight) { // flyKeyState.put(player, keyFly); // descendKeyState.put(player, keyDescend); // // forwardKeyState.put(player, keyForward); // backwardKeyState.put(player, keyBackward); // leftKeyState.put(player, keyLeft); // rightKeyState.put(player, keyRight); // } // // public static void processJetpackUpdate(int entityId, ParticleType particleType) { // if (particleType != null) { // jetpackState.put(entityId, particleType); // } else { // jetpackState.remove(entityId); // } // } // // public static Map<Integer, ParticleType> getJetpackStates() { // return jetpackState; // } // // public static void clearAll() { // flyKeyState.clear(); // forwardKeyState.clear(); // backwardKeyState.clear(); // leftKeyState.clear(); // rightKeyState.clear(); // } // // private static void removeFromAll(EntityPlayer player) { // flyKeyState.remove(player); // forwardKeyState.remove(player); // backwardKeyState.remove(player); // leftKeyState.remove(player); // rightKeyState.remove(player); // } // // @SubscribeEvent // public void onPlayerLoggedIn(PlayerLoggedInEvent evt) { // PacketHandler.instance.sendTo(new MessageConfigSync(), (EntityPlayerMP) evt.player); // } // // @SubscribeEvent // public void onPlayerLoggedOut(PlayerLoggedOutEvent evt) { // removeFromAll(evt.player); // } // // @SubscribeEvent // public void onDimChanged(PlayerChangedDimensionEvent evt) { // removeFromAll(evt.player); // } // // @SubscribeEvent // public void onClientDisconnectedFromServer(ClientDisconnectionFromServerEvent evt) { // SoundJetpack.clearPlayingFor(); // Config.onConfigChanged(SimplyJetpacks.MODID); // } // // } // // Path: src/main/java/tonius/simplyjetpacks/setup/ParticleType.java // public enum ParticleType { // DEFAULT, // NONE, // SMOKE, // RAINBOW_SMOKE, // BUBBLE // }
import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import tonius.simplyjetpacks.handler.SyncHandler; import tonius.simplyjetpacks.setup.ParticleType; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext;
package tonius.simplyjetpacks.network.message; public class MessageJetpackSync implements IMessage, IMessageHandler<MessageJetpackSync, IMessage> { public int entityId; public int particleId; public MessageJetpackSync() { } public MessageJetpackSync(int entityId, int particleId) { this.entityId = entityId; this.particleId = particleId; } @Override public void fromBytes(ByteBuf buf) { this.entityId = buf.readInt(); this.particleId = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(this.entityId); buf.writeInt(this.particleId); } @Override public IMessage onMessage(MessageJetpackSync msg, MessageContext ctx) { Entity entity = FMLClientHandler.instance().getClient().theWorld.getEntityByID(msg.entityId); if (entity != null && entity instanceof EntityLivingBase && entity != FMLClientHandler.instance().getClient().thePlayer) { if (msg.particleId >= 0) {
// Path: src/main/java/tonius/simplyjetpacks/handler/SyncHandler.java // public class SyncHandler { // // private static final Map<EntityPlayer, Boolean> flyKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> descendKeyState = new HashMap<EntityPlayer, Boolean>(); // // private static final Map<EntityPlayer, Boolean> forwardKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> backwardKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> leftKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> rightKeyState = new HashMap<EntityPlayer, Boolean>(); // // private static final Map<Integer, ParticleType> jetpackState = new HashMap<Integer, ParticleType>(); // // public static boolean isFlyKeyDown(EntityLivingBase user) { // return !(user instanceof EntityPlayer) || flyKeyState.containsKey(user) && flyKeyState.get(user); // } // // public static boolean isDescendKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && descendKeyState.containsKey(user) && descendKeyState.get(user); // } // // public static boolean isForwardKeyDown(EntityLivingBase user) { // return !(user instanceof EntityPlayer) || forwardKeyState.containsKey(user) && forwardKeyState.get(user); // } // // public static boolean isBackwardKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && backwardKeyState.containsKey(user) && backwardKeyState.get(user); // } // // public static boolean isLeftKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && leftKeyState.containsKey(user) && leftKeyState.get(user); // } // // public static boolean isRightKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && rightKeyState.containsKey(user) && rightKeyState.get(user); // } // // public static void processKeyUpdate(EntityPlayer player, boolean keyFly, boolean keyDescend, boolean keyForward, boolean keyBackward, boolean keyLeft, boolean keyRight) { // flyKeyState.put(player, keyFly); // descendKeyState.put(player, keyDescend); // // forwardKeyState.put(player, keyForward); // backwardKeyState.put(player, keyBackward); // leftKeyState.put(player, keyLeft); // rightKeyState.put(player, keyRight); // } // // public static void processJetpackUpdate(int entityId, ParticleType particleType) { // if (particleType != null) { // jetpackState.put(entityId, particleType); // } else { // jetpackState.remove(entityId); // } // } // // public static Map<Integer, ParticleType> getJetpackStates() { // return jetpackState; // } // // public static void clearAll() { // flyKeyState.clear(); // forwardKeyState.clear(); // backwardKeyState.clear(); // leftKeyState.clear(); // rightKeyState.clear(); // } // // private static void removeFromAll(EntityPlayer player) { // flyKeyState.remove(player); // forwardKeyState.remove(player); // backwardKeyState.remove(player); // leftKeyState.remove(player); // rightKeyState.remove(player); // } // // @SubscribeEvent // public void onPlayerLoggedIn(PlayerLoggedInEvent evt) { // PacketHandler.instance.sendTo(new MessageConfigSync(), (EntityPlayerMP) evt.player); // } // // @SubscribeEvent // public void onPlayerLoggedOut(PlayerLoggedOutEvent evt) { // removeFromAll(evt.player); // } // // @SubscribeEvent // public void onDimChanged(PlayerChangedDimensionEvent evt) { // removeFromAll(evt.player); // } // // @SubscribeEvent // public void onClientDisconnectedFromServer(ClientDisconnectionFromServerEvent evt) { // SoundJetpack.clearPlayingFor(); // Config.onConfigChanged(SimplyJetpacks.MODID); // } // // } // // Path: src/main/java/tonius/simplyjetpacks/setup/ParticleType.java // public enum ParticleType { // DEFAULT, // NONE, // SMOKE, // RAINBOW_SMOKE, // BUBBLE // } // Path: src/main/java/tonius/simplyjetpacks/network/message/MessageJetpackSync.java import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import tonius.simplyjetpacks.handler.SyncHandler; import tonius.simplyjetpacks.setup.ParticleType; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; package tonius.simplyjetpacks.network.message; public class MessageJetpackSync implements IMessage, IMessageHandler<MessageJetpackSync, IMessage> { public int entityId; public int particleId; public MessageJetpackSync() { } public MessageJetpackSync(int entityId, int particleId) { this.entityId = entityId; this.particleId = particleId; } @Override public void fromBytes(ByteBuf buf) { this.entityId = buf.readInt(); this.particleId = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(this.entityId); buf.writeInt(this.particleId); } @Override public IMessage onMessage(MessageJetpackSync msg, MessageContext ctx) { Entity entity = FMLClientHandler.instance().getClient().theWorld.getEntityByID(msg.entityId); if (entity != null && entity instanceof EntityLivingBase && entity != FMLClientHandler.instance().getClient().thePlayer) { if (msg.particleId >= 0) {
ParticleType particle = ParticleType.values()[msg.particleId];
Tonius/SimplyJetpacks
src/main/java/tonius/simplyjetpacks/network/message/MessageJetpackSync.java
// Path: src/main/java/tonius/simplyjetpacks/handler/SyncHandler.java // public class SyncHandler { // // private static final Map<EntityPlayer, Boolean> flyKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> descendKeyState = new HashMap<EntityPlayer, Boolean>(); // // private static final Map<EntityPlayer, Boolean> forwardKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> backwardKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> leftKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> rightKeyState = new HashMap<EntityPlayer, Boolean>(); // // private static final Map<Integer, ParticleType> jetpackState = new HashMap<Integer, ParticleType>(); // // public static boolean isFlyKeyDown(EntityLivingBase user) { // return !(user instanceof EntityPlayer) || flyKeyState.containsKey(user) && flyKeyState.get(user); // } // // public static boolean isDescendKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && descendKeyState.containsKey(user) && descendKeyState.get(user); // } // // public static boolean isForwardKeyDown(EntityLivingBase user) { // return !(user instanceof EntityPlayer) || forwardKeyState.containsKey(user) && forwardKeyState.get(user); // } // // public static boolean isBackwardKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && backwardKeyState.containsKey(user) && backwardKeyState.get(user); // } // // public static boolean isLeftKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && leftKeyState.containsKey(user) && leftKeyState.get(user); // } // // public static boolean isRightKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && rightKeyState.containsKey(user) && rightKeyState.get(user); // } // // public static void processKeyUpdate(EntityPlayer player, boolean keyFly, boolean keyDescend, boolean keyForward, boolean keyBackward, boolean keyLeft, boolean keyRight) { // flyKeyState.put(player, keyFly); // descendKeyState.put(player, keyDescend); // // forwardKeyState.put(player, keyForward); // backwardKeyState.put(player, keyBackward); // leftKeyState.put(player, keyLeft); // rightKeyState.put(player, keyRight); // } // // public static void processJetpackUpdate(int entityId, ParticleType particleType) { // if (particleType != null) { // jetpackState.put(entityId, particleType); // } else { // jetpackState.remove(entityId); // } // } // // public static Map<Integer, ParticleType> getJetpackStates() { // return jetpackState; // } // // public static void clearAll() { // flyKeyState.clear(); // forwardKeyState.clear(); // backwardKeyState.clear(); // leftKeyState.clear(); // rightKeyState.clear(); // } // // private static void removeFromAll(EntityPlayer player) { // flyKeyState.remove(player); // forwardKeyState.remove(player); // backwardKeyState.remove(player); // leftKeyState.remove(player); // rightKeyState.remove(player); // } // // @SubscribeEvent // public void onPlayerLoggedIn(PlayerLoggedInEvent evt) { // PacketHandler.instance.sendTo(new MessageConfigSync(), (EntityPlayerMP) evt.player); // } // // @SubscribeEvent // public void onPlayerLoggedOut(PlayerLoggedOutEvent evt) { // removeFromAll(evt.player); // } // // @SubscribeEvent // public void onDimChanged(PlayerChangedDimensionEvent evt) { // removeFromAll(evt.player); // } // // @SubscribeEvent // public void onClientDisconnectedFromServer(ClientDisconnectionFromServerEvent evt) { // SoundJetpack.clearPlayingFor(); // Config.onConfigChanged(SimplyJetpacks.MODID); // } // // } // // Path: src/main/java/tonius/simplyjetpacks/setup/ParticleType.java // public enum ParticleType { // DEFAULT, // NONE, // SMOKE, // RAINBOW_SMOKE, // BUBBLE // }
import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import tonius.simplyjetpacks.handler.SyncHandler; import tonius.simplyjetpacks.setup.ParticleType; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext;
package tonius.simplyjetpacks.network.message; public class MessageJetpackSync implements IMessage, IMessageHandler<MessageJetpackSync, IMessage> { public int entityId; public int particleId; public MessageJetpackSync() { } public MessageJetpackSync(int entityId, int particleId) { this.entityId = entityId; this.particleId = particleId; } @Override public void fromBytes(ByteBuf buf) { this.entityId = buf.readInt(); this.particleId = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(this.entityId); buf.writeInt(this.particleId); } @Override public IMessage onMessage(MessageJetpackSync msg, MessageContext ctx) { Entity entity = FMLClientHandler.instance().getClient().theWorld.getEntityByID(msg.entityId); if (entity != null && entity instanceof EntityLivingBase && entity != FMLClientHandler.instance().getClient().thePlayer) { if (msg.particleId >= 0) { ParticleType particle = ParticleType.values()[msg.particleId];
// Path: src/main/java/tonius/simplyjetpacks/handler/SyncHandler.java // public class SyncHandler { // // private static final Map<EntityPlayer, Boolean> flyKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> descendKeyState = new HashMap<EntityPlayer, Boolean>(); // // private static final Map<EntityPlayer, Boolean> forwardKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> backwardKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> leftKeyState = new HashMap<EntityPlayer, Boolean>(); // private static final Map<EntityPlayer, Boolean> rightKeyState = new HashMap<EntityPlayer, Boolean>(); // // private static final Map<Integer, ParticleType> jetpackState = new HashMap<Integer, ParticleType>(); // // public static boolean isFlyKeyDown(EntityLivingBase user) { // return !(user instanceof EntityPlayer) || flyKeyState.containsKey(user) && flyKeyState.get(user); // } // // public static boolean isDescendKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && descendKeyState.containsKey(user) && descendKeyState.get(user); // } // // public static boolean isForwardKeyDown(EntityLivingBase user) { // return !(user instanceof EntityPlayer) || forwardKeyState.containsKey(user) && forwardKeyState.get(user); // } // // public static boolean isBackwardKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && backwardKeyState.containsKey(user) && backwardKeyState.get(user); // } // // public static boolean isLeftKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && leftKeyState.containsKey(user) && leftKeyState.get(user); // } // // public static boolean isRightKeyDown(EntityLivingBase user) { // return user instanceof EntityPlayer && rightKeyState.containsKey(user) && rightKeyState.get(user); // } // // public static void processKeyUpdate(EntityPlayer player, boolean keyFly, boolean keyDescend, boolean keyForward, boolean keyBackward, boolean keyLeft, boolean keyRight) { // flyKeyState.put(player, keyFly); // descendKeyState.put(player, keyDescend); // // forwardKeyState.put(player, keyForward); // backwardKeyState.put(player, keyBackward); // leftKeyState.put(player, keyLeft); // rightKeyState.put(player, keyRight); // } // // public static void processJetpackUpdate(int entityId, ParticleType particleType) { // if (particleType != null) { // jetpackState.put(entityId, particleType); // } else { // jetpackState.remove(entityId); // } // } // // public static Map<Integer, ParticleType> getJetpackStates() { // return jetpackState; // } // // public static void clearAll() { // flyKeyState.clear(); // forwardKeyState.clear(); // backwardKeyState.clear(); // leftKeyState.clear(); // rightKeyState.clear(); // } // // private static void removeFromAll(EntityPlayer player) { // flyKeyState.remove(player); // forwardKeyState.remove(player); // backwardKeyState.remove(player); // leftKeyState.remove(player); // rightKeyState.remove(player); // } // // @SubscribeEvent // public void onPlayerLoggedIn(PlayerLoggedInEvent evt) { // PacketHandler.instance.sendTo(new MessageConfigSync(), (EntityPlayerMP) evt.player); // } // // @SubscribeEvent // public void onPlayerLoggedOut(PlayerLoggedOutEvent evt) { // removeFromAll(evt.player); // } // // @SubscribeEvent // public void onDimChanged(PlayerChangedDimensionEvent evt) { // removeFromAll(evt.player); // } // // @SubscribeEvent // public void onClientDisconnectedFromServer(ClientDisconnectionFromServerEvent evt) { // SoundJetpack.clearPlayingFor(); // Config.onConfigChanged(SimplyJetpacks.MODID); // } // // } // // Path: src/main/java/tonius/simplyjetpacks/setup/ParticleType.java // public enum ParticleType { // DEFAULT, // NONE, // SMOKE, // RAINBOW_SMOKE, // BUBBLE // } // Path: src/main/java/tonius/simplyjetpacks/network/message/MessageJetpackSync.java import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import tonius.simplyjetpacks.handler.SyncHandler; import tonius.simplyjetpacks.setup.ParticleType; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; package tonius.simplyjetpacks.network.message; public class MessageJetpackSync implements IMessage, IMessageHandler<MessageJetpackSync, IMessage> { public int entityId; public int particleId; public MessageJetpackSync() { } public MessageJetpackSync(int entityId, int particleId) { this.entityId = entityId; this.particleId = particleId; } @Override public void fromBytes(ByteBuf buf) { this.entityId = buf.readInt(); this.particleId = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(this.entityId); buf.writeInt(this.particleId); } @Override public IMessage onMessage(MessageJetpackSync msg, MessageContext ctx) { Entity entity = FMLClientHandler.instance().getClient().theWorld.getEntityByID(msg.entityId); if (entity != null && entity instanceof EntityLivingBase && entity != FMLClientHandler.instance().getClient().thePlayer) { if (msg.particleId >= 0) { ParticleType particle = ParticleType.values()[msg.particleId];
SyncHandler.processJetpackUpdate(msg.entityId, particle);
Tonius/SimplyJetpacks
src/main/java/tonius/simplyjetpacks/gui/element/ElementFluidTankAdv.java
// Path: src/main/java/tonius/simplyjetpacks/SimplyJetpacks.java // @Mod(modid = SimplyJetpacks.MODID, version = SimplyJetpacks.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES, guiFactory = SimplyJetpacks.GUI_FACTORY) // public class SimplyJetpacks { // // public static final String MODID = "simplyjetpacks"; // public static final String VERSION = "@VERSION@"; // public static final String PREFIX = MODID + "."; // public static final String RESOURCE_PREFIX = MODID + ":"; // public static final String DEPENDENCIES = "required-after:Forge@[10.13.2.1291,);after:ThermalExpansion;after:RedstoneArsenal;after:RArm;after:EnderIO@[1.7.10-2.1.3.243,);after:BuildCraft|Core@[6.4.15,7.0.0),[7.0.4,)"; // public static final String GUI_FACTORY = "tonius.simplyjetpacks.config.ConfigGuiFactory"; // // @Instance(MODID) // public static SimplyJetpacks instance; // @SidedProxy(clientSide = "tonius.simplyjetpacks.client.ClientProxy", serverSide = "tonius.simplyjetpacks.CommonProxy") // public static CommonProxy proxy; // public static Logger logger; // public static SyncHandler keyboard; // // @EventHandler // public static void preInit(FMLPreInitializationEvent evt) { // logger = evt.getModLog(); // logger.info("Starting Simply Jetpacks"); // // checkCoFHLib(); // // Packs.preInit(); // Config.preInit(evt); // ModItems.preInit(); // } // // @EventHandler // public static void init(FMLInitializationEvent evt) { // RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped"); // proxy.registerHandlers(); // PacketHandler.init(); // ModItems.init(); // ModEnchantments.init(); // } // // @EventHandler // public static void serverStopping(FMLServerStoppingEvent evt) { // SyncHandler.clearAll(); // } // // private static void checkCoFHLib() { // try { // Class.forName("cofh.lib.util.helpers.FireworksHelper$Explosion"); // logger.info("Successfully found CoFHLib"); // return; // // } catch (ClassNotFoundException e) { // logger.error("Could not find CoFHLib!"); // proxy.throwCoFHLibException(); // } // } // // }
import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.IFluidTank; import tonius.simplyjetpacks.SimplyJetpacks; import cofh.lib.gui.GuiBase; import cofh.lib.gui.element.ElementFluidTank; import cofh.lib.render.RenderHelper;
package tonius.simplyjetpacks.gui.element; public class ElementFluidTankAdv extends ElementFluidTank { public ElementFluidTankAdv(GuiBase gui, int posX, int posY, IFluidTank tank) { super(gui, posX, posY, tank);
// Path: src/main/java/tonius/simplyjetpacks/SimplyJetpacks.java // @Mod(modid = SimplyJetpacks.MODID, version = SimplyJetpacks.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES, guiFactory = SimplyJetpacks.GUI_FACTORY) // public class SimplyJetpacks { // // public static final String MODID = "simplyjetpacks"; // public static final String VERSION = "@VERSION@"; // public static final String PREFIX = MODID + "."; // public static final String RESOURCE_PREFIX = MODID + ":"; // public static final String DEPENDENCIES = "required-after:Forge@[10.13.2.1291,);after:ThermalExpansion;after:RedstoneArsenal;after:RArm;after:EnderIO@[1.7.10-2.1.3.243,);after:BuildCraft|Core@[6.4.15,7.0.0),[7.0.4,)"; // public static final String GUI_FACTORY = "tonius.simplyjetpacks.config.ConfigGuiFactory"; // // @Instance(MODID) // public static SimplyJetpacks instance; // @SidedProxy(clientSide = "tonius.simplyjetpacks.client.ClientProxy", serverSide = "tonius.simplyjetpacks.CommonProxy") // public static CommonProxy proxy; // public static Logger logger; // public static SyncHandler keyboard; // // @EventHandler // public static void preInit(FMLPreInitializationEvent evt) { // logger = evt.getModLog(); // logger.info("Starting Simply Jetpacks"); // // checkCoFHLib(); // // Packs.preInit(); // Config.preInit(evt); // ModItems.preInit(); // } // // @EventHandler // public static void init(FMLInitializationEvent evt) { // RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped"); // proxy.registerHandlers(); // PacketHandler.init(); // ModItems.init(); // ModEnchantments.init(); // } // // @EventHandler // public static void serverStopping(FMLServerStoppingEvent evt) { // SyncHandler.clearAll(); // } // // private static void checkCoFHLib() { // try { // Class.forName("cofh.lib.util.helpers.FireworksHelper$Explosion"); // logger.info("Successfully found CoFHLib"); // return; // // } catch (ClassNotFoundException e) { // logger.error("Could not find CoFHLib!"); // proxy.throwCoFHLibException(); // } // } // // } // Path: src/main/java/tonius/simplyjetpacks/gui/element/ElementFluidTankAdv.java import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.IFluidTank; import tonius.simplyjetpacks.SimplyJetpacks; import cofh.lib.gui.GuiBase; import cofh.lib.gui.element.ElementFluidTank; import cofh.lib.render.RenderHelper; package tonius.simplyjetpacks.gui.element; public class ElementFluidTankAdv extends ElementFluidTank { public ElementFluidTankAdv(GuiBase gui, int posX, int posY, IFluidTank tank) { super(gui, posX, posY, tank);
this.texture = new ResourceLocation(SimplyJetpacks.RESOURCE_PREFIX + "textures/gui/elements/fluidTank.png");
Tonius/SimplyJetpacks
src/main/java/tonius/simplyjetpacks/gui/element/ElementEnergyStoredAdv.java
// Path: src/main/java/tonius/simplyjetpacks/SimplyJetpacks.java // @Mod(modid = SimplyJetpacks.MODID, version = SimplyJetpacks.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES, guiFactory = SimplyJetpacks.GUI_FACTORY) // public class SimplyJetpacks { // // public static final String MODID = "simplyjetpacks"; // public static final String VERSION = "@VERSION@"; // public static final String PREFIX = MODID + "."; // public static final String RESOURCE_PREFIX = MODID + ":"; // public static final String DEPENDENCIES = "required-after:Forge@[10.13.2.1291,);after:ThermalExpansion;after:RedstoneArsenal;after:RArm;after:EnderIO@[1.7.10-2.1.3.243,);after:BuildCraft|Core@[6.4.15,7.0.0),[7.0.4,)"; // public static final String GUI_FACTORY = "tonius.simplyjetpacks.config.ConfigGuiFactory"; // // @Instance(MODID) // public static SimplyJetpacks instance; // @SidedProxy(clientSide = "tonius.simplyjetpacks.client.ClientProxy", serverSide = "tonius.simplyjetpacks.CommonProxy") // public static CommonProxy proxy; // public static Logger logger; // public static SyncHandler keyboard; // // @EventHandler // public static void preInit(FMLPreInitializationEvent evt) { // logger = evt.getModLog(); // logger.info("Starting Simply Jetpacks"); // // checkCoFHLib(); // // Packs.preInit(); // Config.preInit(evt); // ModItems.preInit(); // } // // @EventHandler // public static void init(FMLInitializationEvent evt) { // RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped"); // proxy.registerHandlers(); // PacketHandler.init(); // ModItems.init(); // ModEnchantments.init(); // } // // @EventHandler // public static void serverStopping(FMLServerStoppingEvent evt) { // SyncHandler.clearAll(); // } // // private static void checkCoFHLib() { // try { // Class.forName("cofh.lib.util.helpers.FireworksHelper$Explosion"); // logger.info("Successfully found CoFHLib"); // return; // // } catch (ClassNotFoundException e) { // logger.error("Could not find CoFHLib!"); // proxy.throwCoFHLibException(); // } // } // // }
import net.minecraft.util.ResourceLocation; import tonius.simplyjetpacks.SimplyJetpacks; import cofh.api.energy.IEnergyStorage; import cofh.lib.gui.GuiBase; import cofh.lib.gui.element.ElementEnergyStored;
package tonius.simplyjetpacks.gui.element; public class ElementEnergyStoredAdv extends ElementEnergyStored { public ElementEnergyStoredAdv(GuiBase gui, int posX, int posY, IEnergyStorage storage) { super(gui, posX, posY, storage);
// Path: src/main/java/tonius/simplyjetpacks/SimplyJetpacks.java // @Mod(modid = SimplyJetpacks.MODID, version = SimplyJetpacks.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES, guiFactory = SimplyJetpacks.GUI_FACTORY) // public class SimplyJetpacks { // // public static final String MODID = "simplyjetpacks"; // public static final String VERSION = "@VERSION@"; // public static final String PREFIX = MODID + "."; // public static final String RESOURCE_PREFIX = MODID + ":"; // public static final String DEPENDENCIES = "required-after:Forge@[10.13.2.1291,);after:ThermalExpansion;after:RedstoneArsenal;after:RArm;after:EnderIO@[1.7.10-2.1.3.243,);after:BuildCraft|Core@[6.4.15,7.0.0),[7.0.4,)"; // public static final String GUI_FACTORY = "tonius.simplyjetpacks.config.ConfigGuiFactory"; // // @Instance(MODID) // public static SimplyJetpacks instance; // @SidedProxy(clientSide = "tonius.simplyjetpacks.client.ClientProxy", serverSide = "tonius.simplyjetpacks.CommonProxy") // public static CommonProxy proxy; // public static Logger logger; // public static SyncHandler keyboard; // // @EventHandler // public static void preInit(FMLPreInitializationEvent evt) { // logger = evt.getModLog(); // logger.info("Starting Simply Jetpacks"); // // checkCoFHLib(); // // Packs.preInit(); // Config.preInit(evt); // ModItems.preInit(); // } // // @EventHandler // public static void init(FMLInitializationEvent evt) { // RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped"); // proxy.registerHandlers(); // PacketHandler.init(); // ModItems.init(); // ModEnchantments.init(); // } // // @EventHandler // public static void serverStopping(FMLServerStoppingEvent evt) { // SyncHandler.clearAll(); // } // // private static void checkCoFHLib() { // try { // Class.forName("cofh.lib.util.helpers.FireworksHelper$Explosion"); // logger.info("Successfully found CoFHLib"); // return; // // } catch (ClassNotFoundException e) { // logger.error("Could not find CoFHLib!"); // proxy.throwCoFHLibException(); // } // } // // } // Path: src/main/java/tonius/simplyjetpacks/gui/element/ElementEnergyStoredAdv.java import net.minecraft.util.ResourceLocation; import tonius.simplyjetpacks.SimplyJetpacks; import cofh.api.energy.IEnergyStorage; import cofh.lib.gui.GuiBase; import cofh.lib.gui.element.ElementEnergyStored; package tonius.simplyjetpacks.gui.element; public class ElementEnergyStoredAdv extends ElementEnergyStored { public ElementEnergyStoredAdv(GuiBase gui, int posX, int posY, IEnergyStorage storage) { super(gui, posX, posY, storage);
this.texture = new ResourceLocation(SimplyJetpacks.RESOURCE_PREFIX + "textures/gui/elements/energy.png");
Tonius/SimplyJetpacks
src/main/java/tonius/simplyjetpacks/integration/RAItems.java
// Path: src/main/java/tonius/simplyjetpacks/SimplyJetpacks.java // @Mod(modid = SimplyJetpacks.MODID, version = SimplyJetpacks.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES, guiFactory = SimplyJetpacks.GUI_FACTORY) // public class SimplyJetpacks { // // public static final String MODID = "simplyjetpacks"; // public static final String VERSION = "@VERSION@"; // public static final String PREFIX = MODID + "."; // public static final String RESOURCE_PREFIX = MODID + ":"; // public static final String DEPENDENCIES = "required-after:Forge@[10.13.2.1291,);after:ThermalExpansion;after:RedstoneArsenal;after:RArm;after:EnderIO@[1.7.10-2.1.3.243,);after:BuildCraft|Core@[6.4.15,7.0.0),[7.0.4,)"; // public static final String GUI_FACTORY = "tonius.simplyjetpacks.config.ConfigGuiFactory"; // // @Instance(MODID) // public static SimplyJetpacks instance; // @SidedProxy(clientSide = "tonius.simplyjetpacks.client.ClientProxy", serverSide = "tonius.simplyjetpacks.CommonProxy") // public static CommonProxy proxy; // public static Logger logger; // public static SyncHandler keyboard; // // @EventHandler // public static void preInit(FMLPreInitializationEvent evt) { // logger = evt.getModLog(); // logger.info("Starting Simply Jetpacks"); // // checkCoFHLib(); // // Packs.preInit(); // Config.preInit(evt); // ModItems.preInit(); // } // // @EventHandler // public static void init(FMLInitializationEvent evt) { // RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped"); // proxy.registerHandlers(); // PacketHandler.init(); // ModItems.init(); // ModEnchantments.init(); // } // // @EventHandler // public static void serverStopping(FMLServerStoppingEvent evt) { // SyncHandler.clearAll(); // } // // private static void checkCoFHLib() { // try { // Class.forName("cofh.lib.util.helpers.FireworksHelper$Explosion"); // logger.info("Successfully found CoFHLib"); // return; // // } catch (ClassNotFoundException e) { // logger.error("Could not find CoFHLib!"); // proxy.throwCoFHLibException(); // } // } // // }
import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; import tonius.simplyjetpacks.SimplyJetpacks; import cpw.mods.fml.common.registry.GameRegistry;
package tonius.simplyjetpacks.integration; public abstract class RAItems { public static ItemStack plateFlux = null; public static ItemStack armorFluxPlate = null; public static void init() {
// Path: src/main/java/tonius/simplyjetpacks/SimplyJetpacks.java // @Mod(modid = SimplyJetpacks.MODID, version = SimplyJetpacks.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES, guiFactory = SimplyJetpacks.GUI_FACTORY) // public class SimplyJetpacks { // // public static final String MODID = "simplyjetpacks"; // public static final String VERSION = "@VERSION@"; // public static final String PREFIX = MODID + "."; // public static final String RESOURCE_PREFIX = MODID + ":"; // public static final String DEPENDENCIES = "required-after:Forge@[10.13.2.1291,);after:ThermalExpansion;after:RedstoneArsenal;after:RArm;after:EnderIO@[1.7.10-2.1.3.243,);after:BuildCraft|Core@[6.4.15,7.0.0),[7.0.4,)"; // public static final String GUI_FACTORY = "tonius.simplyjetpacks.config.ConfigGuiFactory"; // // @Instance(MODID) // public static SimplyJetpacks instance; // @SidedProxy(clientSide = "tonius.simplyjetpacks.client.ClientProxy", serverSide = "tonius.simplyjetpacks.CommonProxy") // public static CommonProxy proxy; // public static Logger logger; // public static SyncHandler keyboard; // // @EventHandler // public static void preInit(FMLPreInitializationEvent evt) { // logger = evt.getModLog(); // logger.info("Starting Simply Jetpacks"); // // checkCoFHLib(); // // Packs.preInit(); // Config.preInit(evt); // ModItems.preInit(); // } // // @EventHandler // public static void init(FMLInitializationEvent evt) { // RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped"); // proxy.registerHandlers(); // PacketHandler.init(); // ModItems.init(); // ModEnchantments.init(); // } // // @EventHandler // public static void serverStopping(FMLServerStoppingEvent evt) { // SyncHandler.clearAll(); // } // // private static void checkCoFHLib() { // try { // Class.forName("cofh.lib.util.helpers.FireworksHelper$Explosion"); // logger.info("Successfully found CoFHLib"); // return; // // } catch (ClassNotFoundException e) { // logger.error("Could not find CoFHLib!"); // proxy.throwCoFHLibException(); // } // } // // } // Path: src/main/java/tonius/simplyjetpacks/integration/RAItems.java import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; import tonius.simplyjetpacks.SimplyJetpacks; import cpw.mods.fml.common.registry.GameRegistry; package tonius.simplyjetpacks.integration; public abstract class RAItems { public static ItemStack plateFlux = null; public static ItemStack armorFluxPlate = null; public static void init() {
SimplyJetpacks.logger.info("Stealing Redstone Arsenal's items");
Tonius/SimplyJetpacks
src/main/java/tonius/simplyjetpacks/network/message/MessageModKey.java
// Path: src/main/java/tonius/simplyjetpacks/setup/ModKey.java // public enum ModKey { // // TOGGLE_PRIMARY("toggle.primary", false, 176, 0, 176, 20, 176, 40), // TOGGLE_SECONDARY("toggle.secondary", false, 196, 0, 196, 20, 196, 40), // MODE_PRIMARY("mode.primary", false, 216, 0, 216, 20, 216, 40), // MODE_SECONDARY("mode.secondary", true, 236, 0, 236, 20, 236, 40), // OPEN_PACK_GUI(null, false, 0, 0, 0, 0, 0, 0); // // public final String name; // public final boolean alwaysShowInChat; // public final int sheetX; // public final int sheetY; // public final int hoverX; // public final int hoverY; // public final int disabledX; // public final int disabledY; // // private ModKey(String tooltip, boolean alwaysShowInChat, int sheetX, int sheetY, int hoverX, int hoverY, int disabledX, int disabledY) { // this.name = tooltip; // this.alwaysShowInChat = alwaysShowInChat; // this.sheetX = sheetX; // this.sheetY = sheetY; // this.hoverX = hoverX; // this.hoverY = hoverY; // this.disabledX = disabledX; // this.disabledY = disabledY; // } // // }
import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import tonius.simplyjetpacks.item.IControllableArmor; import tonius.simplyjetpacks.setup.ModKey; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext;
package tonius.simplyjetpacks.network.message; public class MessageModKey implements IMessage, IMessageHandler<MessageModKey, IMessage> { public int keyId; public boolean showInChat; public MessageModKey() { }
// Path: src/main/java/tonius/simplyjetpacks/setup/ModKey.java // public enum ModKey { // // TOGGLE_PRIMARY("toggle.primary", false, 176, 0, 176, 20, 176, 40), // TOGGLE_SECONDARY("toggle.secondary", false, 196, 0, 196, 20, 196, 40), // MODE_PRIMARY("mode.primary", false, 216, 0, 216, 20, 216, 40), // MODE_SECONDARY("mode.secondary", true, 236, 0, 236, 20, 236, 40), // OPEN_PACK_GUI(null, false, 0, 0, 0, 0, 0, 0); // // public final String name; // public final boolean alwaysShowInChat; // public final int sheetX; // public final int sheetY; // public final int hoverX; // public final int hoverY; // public final int disabledX; // public final int disabledY; // // private ModKey(String tooltip, boolean alwaysShowInChat, int sheetX, int sheetY, int hoverX, int hoverY, int disabledX, int disabledY) { // this.name = tooltip; // this.alwaysShowInChat = alwaysShowInChat; // this.sheetX = sheetX; // this.sheetY = sheetY; // this.hoverX = hoverX; // this.hoverY = hoverY; // this.disabledX = disabledX; // this.disabledY = disabledY; // } // // } // Path: src/main/java/tonius/simplyjetpacks/network/message/MessageModKey.java import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import tonius.simplyjetpacks.item.IControllableArmor; import tonius.simplyjetpacks.setup.ModKey; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; package tonius.simplyjetpacks.network.message; public class MessageModKey implements IMessage, IMessageHandler<MessageModKey, IMessage> { public int keyId; public boolean showInChat; public MessageModKey() { }
public MessageModKey(ModKey key, boolean showInChat) {
Tonius/SimplyJetpacks
src/main/java/tonius/simplyjetpacks/config/PackDefaults.java
// Path: src/main/java/tonius/simplyjetpacks/integration/ModType.java // public enum ModType { // // SIMPLY_JETPACKS("", SimplyJetpacks.MODID), // THERMAL_EXPANSION(".te", "ThermalExpansion"), // THERMAL_DYNAMICS(null, "ThermalDynamics"), // REDSTONE_ARSENAL(null, "RedstoneArsenal"), // REDSTONE_ARMORY(null, "RArm"), // ENDER_IO(".eio", "EnderIO"), // BUILDCRAFT(".bc", "BuildCraft|Core"); // // public final String suffix; // public final String[] modids; // public final boolean loaded; // // private ModType(String suffix, String... modids) { // this.suffix = suffix; // this.modids = modids; // // for (String s : this.modids) { // if (!Loader.isModLoaded(s)) { // this.loaded = false; // return; // } // } // this.loaded = true; // } // // }
import java.util.HashMap; import java.util.Map; import tonius.simplyjetpacks.integration.ModType; import cpw.mods.fml.common.Loader;
public static PackDefaults get(String key) { return DEFAULTS.get(key); } // the great mighty List of Defaults static { // Simply Jetpacks PackDefaults d = new PackDefaults("jetpackPotato", "Tuberous Jetpack"); d.fuelCapacity = 1200; d.fuelUsage = 45; d.speedVertical = 0.9D; d.accelVertical = 0.5D; d = new PackDefaults("jetpackCreative", "Creative Jetpack"); d.fuelPerTickOut = 32000; d.armorReduction = 12; d.enchantability = 20; d.speedVertical = 0.9D; d.accelVertical = 0.15D; d.speedVerticalHover = 0.45D; d.speedVerticalHoverSlow = 0.0D; d.speedSideways = 0.21D; d.sprintSpeedModifier = 2.5D; d.emergencyHoverMode = true; d = new PackDefaults("fluxPackCreative", "Creative Flux Pack"); d.fuelPerTickOut = 32000; d.armorReduction = 8; d.enchantability = 10;
// Path: src/main/java/tonius/simplyjetpacks/integration/ModType.java // public enum ModType { // // SIMPLY_JETPACKS("", SimplyJetpacks.MODID), // THERMAL_EXPANSION(".te", "ThermalExpansion"), // THERMAL_DYNAMICS(null, "ThermalDynamics"), // REDSTONE_ARSENAL(null, "RedstoneArsenal"), // REDSTONE_ARMORY(null, "RArm"), // ENDER_IO(".eio", "EnderIO"), // BUILDCRAFT(".bc", "BuildCraft|Core"); // // public final String suffix; // public final String[] modids; // public final boolean loaded; // // private ModType(String suffix, String... modids) { // this.suffix = suffix; // this.modids = modids; // // for (String s : this.modids) { // if (!Loader.isModLoaded(s)) { // this.loaded = false; // return; // } // } // this.loaded = true; // } // // } // Path: src/main/java/tonius/simplyjetpacks/config/PackDefaults.java import java.util.HashMap; import java.util.Map; import tonius.simplyjetpacks.integration.ModType; import cpw.mods.fml.common.Loader; public static PackDefaults get(String key) { return DEFAULTS.get(key); } // the great mighty List of Defaults static { // Simply Jetpacks PackDefaults d = new PackDefaults("jetpackPotato", "Tuberous Jetpack"); d.fuelCapacity = 1200; d.fuelUsage = 45; d.speedVertical = 0.9D; d.accelVertical = 0.5D; d = new PackDefaults("jetpackCreative", "Creative Jetpack"); d.fuelPerTickOut = 32000; d.armorReduction = 12; d.enchantability = 20; d.speedVertical = 0.9D; d.accelVertical = 0.15D; d.speedVerticalHover = 0.45D; d.speedVerticalHoverSlow = 0.0D; d.speedSideways = 0.21D; d.sprintSpeedModifier = 2.5D; d.emergencyHoverMode = true; d = new PackDefaults("fluxPackCreative", "Creative Flux Pack"); d.fuelPerTickOut = 32000; d.armorReduction = 8; d.enchantability = 10;
if (ModType.THERMAL_EXPANSION.loaded) {
Tonius/SimplyJetpacks
src/main/java/tonius/simplyjetpacks/integration/TEItems.java
// Path: src/main/java/tonius/simplyjetpacks/SimplyJetpacks.java // @Mod(modid = SimplyJetpacks.MODID, version = SimplyJetpacks.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES, guiFactory = SimplyJetpacks.GUI_FACTORY) // public class SimplyJetpacks { // // public static final String MODID = "simplyjetpacks"; // public static final String VERSION = "@VERSION@"; // public static final String PREFIX = MODID + "."; // public static final String RESOURCE_PREFIX = MODID + ":"; // public static final String DEPENDENCIES = "required-after:Forge@[10.13.2.1291,);after:ThermalExpansion;after:RedstoneArsenal;after:RArm;after:EnderIO@[1.7.10-2.1.3.243,);after:BuildCraft|Core@[6.4.15,7.0.0),[7.0.4,)"; // public static final String GUI_FACTORY = "tonius.simplyjetpacks.config.ConfigGuiFactory"; // // @Instance(MODID) // public static SimplyJetpacks instance; // @SidedProxy(clientSide = "tonius.simplyjetpacks.client.ClientProxy", serverSide = "tonius.simplyjetpacks.CommonProxy") // public static CommonProxy proxy; // public static Logger logger; // public static SyncHandler keyboard; // // @EventHandler // public static void preInit(FMLPreInitializationEvent evt) { // logger = evt.getModLog(); // logger.info("Starting Simply Jetpacks"); // // checkCoFHLib(); // // Packs.preInit(); // Config.preInit(evt); // ModItems.preInit(); // } // // @EventHandler // public static void init(FMLInitializationEvent evt) { // RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped"); // proxy.registerHandlers(); // PacketHandler.init(); // ModItems.init(); // ModEnchantments.init(); // } // // @EventHandler // public static void serverStopping(FMLServerStoppingEvent evt) { // SyncHandler.clearAll(); // } // // private static void checkCoFHLib() { // try { // Class.forName("cofh.lib.util.helpers.FireworksHelper$Explosion"); // logger.info("Successfully found CoFHLib"); // return; // // } catch (ClassNotFoundException e) { // logger.error("Could not find CoFHLib!"); // proxy.throwCoFHLibException(); // } // } // // }
import net.minecraft.item.ItemStack; import tonius.simplyjetpacks.SimplyJetpacks; import cpw.mods.fml.common.registry.GameRegistry;
package tonius.simplyjetpacks.integration; public abstract class TEItems { public static ItemStack capacitorBasic = null; public static ItemStack capacitorHardened = null; public static ItemStack capacitorReinforced = null; public static ItemStack capacitorResonant = null; public static ItemStack cellBasic = null; public static ItemStack dynamoReactant = null; public static ItemStack dynamoMagmatic = null; public static ItemStack dynamoEnervation = null; public static ItemStack dynamoSteam = null; public static ItemStack frameCellReinforcedFull = null; public static ItemStack frameIlluminator = null; public static ItemStack pneumaticServo = null; public static ItemStack powerCoilElectrum = null; public static ItemStack powerCoilGold = null; public static void init() {
// Path: src/main/java/tonius/simplyjetpacks/SimplyJetpacks.java // @Mod(modid = SimplyJetpacks.MODID, version = SimplyJetpacks.VERSION, dependencies = SimplyJetpacks.DEPENDENCIES, guiFactory = SimplyJetpacks.GUI_FACTORY) // public class SimplyJetpacks { // // public static final String MODID = "simplyjetpacks"; // public static final String VERSION = "@VERSION@"; // public static final String PREFIX = MODID + "."; // public static final String RESOURCE_PREFIX = MODID + ":"; // public static final String DEPENDENCIES = "required-after:Forge@[10.13.2.1291,);after:ThermalExpansion;after:RedstoneArsenal;after:RArm;after:EnderIO@[1.7.10-2.1.3.243,);after:BuildCraft|Core@[6.4.15,7.0.0),[7.0.4,)"; // public static final String GUI_FACTORY = "tonius.simplyjetpacks.config.ConfigGuiFactory"; // // @Instance(MODID) // public static SimplyJetpacks instance; // @SidedProxy(clientSide = "tonius.simplyjetpacks.client.ClientProxy", serverSide = "tonius.simplyjetpacks.CommonProxy") // public static CommonProxy proxy; // public static Logger logger; // public static SyncHandler keyboard; // // @EventHandler // public static void preInit(FMLPreInitializationEvent evt) { // logger = evt.getModLog(); // logger.info("Starting Simply Jetpacks"); // // checkCoFHLib(); // // Packs.preInit(); // Config.preInit(evt); // ModItems.preInit(); // } // // @EventHandler // public static void init(FMLInitializationEvent evt) { // RecipeSorter.register(SimplyJetpacks.MODID + ":upgrading", UpgradingRecipe.class, Category.SHAPED, "after:minecraft:shaped"); // proxy.registerHandlers(); // PacketHandler.init(); // ModItems.init(); // ModEnchantments.init(); // } // // @EventHandler // public static void serverStopping(FMLServerStoppingEvent evt) { // SyncHandler.clearAll(); // } // // private static void checkCoFHLib() { // try { // Class.forName("cofh.lib.util.helpers.FireworksHelper$Explosion"); // logger.info("Successfully found CoFHLib"); // return; // // } catch (ClassNotFoundException e) { // logger.error("Could not find CoFHLib!"); // proxy.throwCoFHLibException(); // } // } // // } // Path: src/main/java/tonius/simplyjetpacks/integration/TEItems.java import net.minecraft.item.ItemStack; import tonius.simplyjetpacks.SimplyJetpacks; import cpw.mods.fml.common.registry.GameRegistry; package tonius.simplyjetpacks.integration; public abstract class TEItems { public static ItemStack capacitorBasic = null; public static ItemStack capacitorHardened = null; public static ItemStack capacitorReinforced = null; public static ItemStack capacitorResonant = null; public static ItemStack cellBasic = null; public static ItemStack dynamoReactant = null; public static ItemStack dynamoMagmatic = null; public static ItemStack dynamoEnervation = null; public static ItemStack dynamoSteam = null; public static ItemStack frameCellReinforcedFull = null; public static ItemStack frameIlluminator = null; public static ItemStack pneumaticServo = null; public static ItemStack powerCoilElectrum = null; public static ItemStack powerCoilGold = null; public static void init() {
SimplyJetpacks.logger.info("Stealing Thermal Expansion's items");
McFoggy/cssfx
src/test/java/fr/brouillard/oss/cssfx/test/TestCleanupDetector.java
// Path: src/main/java/fr/brouillard/oss/cssfx/impl/monitoring/CleanupDetector.java // public class CleanupDetector { // // private static HashSet<WeakReferenceWithRunnable> references = new HashSet<WeakReferenceWithRunnable>(); // private static ReferenceQueue referenceQueue = new ReferenceQueue(); // // static { // Thread cleanupDetectorThread = new Thread(() -> { // while (true) { // try { // WeakReferenceWithRunnable r = (WeakReferenceWithRunnable) referenceQueue.remove(); // references.remove(r); // r.r.run(); // } catch (Throwable e) { // e.printStackTrace(); // } // } // }, "CSSFX-cleanup-detector"); // cleanupDetectorThread.setDaemon(true); // cleanupDetectorThread.start(); // } // // /** // * The runnable gets executed after the object has been collected by the GC. // */ // public static void onCleanup(Object obj, Runnable r) { // onCleanup(new WeakReferenceWithRunnable(obj, referenceQueue, r)); // } // /** // * This version of the method can be used to provide more information // * in the heap dump by extending WeakReferenceWithRunnable. // */ // public static void onCleanup(WeakReferenceWithRunnable weakref) { // references.add(weakref); // } // // /** // * This class can be extended to provide more meta information to the method onCleanup. // */ // public static class WeakReferenceWithRunnable extends WeakReference { // Runnable r = null; // WeakReferenceWithRunnable(Object ref, ReferenceQueue queue, Runnable r) { // super(ref, queue); // this.r = r; // } // } // }
import de.sandec.jmemorybuddy.JMemoryBuddy; import javafx.scene.paint.Color; import fr.brouillard.oss.cssfx.impl.monitoring.CleanupDetector; import org.junit.jupiter.api.Test; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit;
package fr.brouillard.oss.cssfx.test; /* * #%L * CSSFX * %% * Copyright (C) 2014 - 2020 CSSFX by Matthieu Brouillard * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ public class TestCleanupDetector { CountDownLatch latch = new CountDownLatch(1); Runnable r = () -> latch.countDown(); @Test public void isRunnableCalled() throws Exception{ JMemoryBuddy.memoryTest(checker -> { Object o = new Object();
// Path: src/main/java/fr/brouillard/oss/cssfx/impl/monitoring/CleanupDetector.java // public class CleanupDetector { // // private static HashSet<WeakReferenceWithRunnable> references = new HashSet<WeakReferenceWithRunnable>(); // private static ReferenceQueue referenceQueue = new ReferenceQueue(); // // static { // Thread cleanupDetectorThread = new Thread(() -> { // while (true) { // try { // WeakReferenceWithRunnable r = (WeakReferenceWithRunnable) referenceQueue.remove(); // references.remove(r); // r.r.run(); // } catch (Throwable e) { // e.printStackTrace(); // } // } // }, "CSSFX-cleanup-detector"); // cleanupDetectorThread.setDaemon(true); // cleanupDetectorThread.start(); // } // // /** // * The runnable gets executed after the object has been collected by the GC. // */ // public static void onCleanup(Object obj, Runnable r) { // onCleanup(new WeakReferenceWithRunnable(obj, referenceQueue, r)); // } // /** // * This version of the method can be used to provide more information // * in the heap dump by extending WeakReferenceWithRunnable. // */ // public static void onCleanup(WeakReferenceWithRunnable weakref) { // references.add(weakref); // } // // /** // * This class can be extended to provide more meta information to the method onCleanup. // */ // public static class WeakReferenceWithRunnable extends WeakReference { // Runnable r = null; // WeakReferenceWithRunnable(Object ref, ReferenceQueue queue, Runnable r) { // super(ref, queue); // this.r = r; // } // } // } // Path: src/test/java/fr/brouillard/oss/cssfx/test/TestCleanupDetector.java import de.sandec.jmemorybuddy.JMemoryBuddy; import javafx.scene.paint.Color; import fr.brouillard.oss.cssfx.impl.monitoring.CleanupDetector; import org.junit.jupiter.api.Test; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; package fr.brouillard.oss.cssfx.test; /* * #%L * CSSFX * %% * Copyright (C) 2014 - 2020 CSSFX by Matthieu Brouillard * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ public class TestCleanupDetector { CountDownLatch latch = new CountDownLatch(1); Runnable r = () -> latch.countDown(); @Test public void isRunnableCalled() throws Exception{ JMemoryBuddy.memoryTest(checker -> { Object o = new Object();
CleanupDetector.onCleanup(o, r);
McFoggy/cssfx
src/main/java/fr/brouillard/oss/cssfx/impl/monitoring/PathsWatcher.java
// Path: src/main/java/fr/brouillard/oss/cssfx/impl/log/CSSFXLogger.java // public static Logger logger(String loggerName) { // if (!isInitialized()) { // noop(); // } // return loggerFactory.getLogger(loggerName); // }
import java.nio.file.WatchService; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import com.sun.nio.file.SensitivityWatchEventModifier; import static fr.brouillard.oss.cssfx.impl.log.CSSFXLogger.logger; import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.Path; import java.nio.file.StandardWatchEventKinds; import java.nio.file.WatchEvent; import java.nio.file.WatchKey;
package fr.brouillard.oss.cssfx.impl.monitoring; /* * #%L * CSSFX * %% * Copyright (C) 2014 CSSFX by Matthieu Brouillard * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ public class PathsWatcher { private WatchService watchService; private Map<String, Map<String, List<Runnable>>> filesActions = new HashMap<>(); private Thread watcherThread; public PathsWatcher() { try { watchService = FileSystems.getDefault().newWatchService(); } catch (IOException e) {
// Path: src/main/java/fr/brouillard/oss/cssfx/impl/log/CSSFXLogger.java // public static Logger logger(String loggerName) { // if (!isInitialized()) { // noop(); // } // return loggerFactory.getLogger(loggerName); // } // Path: src/main/java/fr/brouillard/oss/cssfx/impl/monitoring/PathsWatcher.java import java.nio.file.WatchService; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import com.sun.nio.file.SensitivityWatchEventModifier; import static fr.brouillard.oss.cssfx.impl.log.CSSFXLogger.logger; import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.Path; import java.nio.file.StandardWatchEventKinds; import java.nio.file.WatchEvent; import java.nio.file.WatchKey; package fr.brouillard.oss.cssfx.impl.monitoring; /* * #%L * CSSFX * %% * Copyright (C) 2014 CSSFX by Matthieu Brouillard * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ public class PathsWatcher { private WatchService watchService; private Map<String, Map<String, List<Runnable>>> filesActions = new HashMap<>(); private Thread watcherThread; public PathsWatcher() { try { watchService = FileSystems.getDefault().newWatchService(); } catch (IOException e) {
logger(PathsWatcher.class).error("cannot create WatchService", e);
McFoggy/cssfx
src/main/java/fr/brouillard/oss/cssfx/impl/URIToPathConverters.java
// Path: src/main/java/fr/brouillard/oss/cssfx/impl/log/CSSFXLogger.java // public static Logger logger(String loggerName) { // if (!isInitialized()) { // noop(); // } // return loggerFactory.getLogger(loggerName); // } // // Path: src/main/java/fr/brouillard/oss/cssfx/api/URIToPathConverter.java // @FunctionalInterface // public interface URIToPathConverter { // public Path convert(String uri); // }
import fr.brouillard.oss.cssfx.api.URIToPathConverter; import static fr.brouillard.oss.cssfx.impl.log.CSSFXLogger.logger; import java.net.URI; import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.regex.Matcher; import java.util.regex.Pattern;
if (uri.contains("target/classes")) { String[] classesTransform = { "src/main/java", "src/main/resources" }; for (String ct : classesTransform) { String potentialSourceURI = uri.replace("target/classes", ct); try { Path p = Paths.get(new URI(potentialSourceURI)); if (Files.exists(p)) { return p; } } catch (URISyntaxException e) { e.printStackTrace(); } } } else if (uri.contains("target/test-classes")) { String[] testClassesTransform = { "src/test/java", "src/test/resources" }; for (String tct : testClassesTransform) { String potentialSourceURI = uri.replace("target/test-classes", tct); try { Path p = Paths.get(new URI(potentialSourceURI)); if (Files.exists(p)) { return p; } } catch (URISyntaxException e) { e.printStackTrace(); } } } }
// Path: src/main/java/fr/brouillard/oss/cssfx/impl/log/CSSFXLogger.java // public static Logger logger(String loggerName) { // if (!isInitialized()) { // noop(); // } // return loggerFactory.getLogger(loggerName); // } // // Path: src/main/java/fr/brouillard/oss/cssfx/api/URIToPathConverter.java // @FunctionalInterface // public interface URIToPathConverter { // public Path convert(String uri); // } // Path: src/main/java/fr/brouillard/oss/cssfx/impl/URIToPathConverters.java import fr.brouillard.oss.cssfx.api.URIToPathConverter; import static fr.brouillard.oss.cssfx.impl.log.CSSFXLogger.logger; import java.net.URI; import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.regex.Matcher; import java.util.regex.Pattern; if (uri.contains("target/classes")) { String[] classesTransform = { "src/main/java", "src/main/resources" }; for (String ct : classesTransform) { String potentialSourceURI = uri.replace("target/classes", ct); try { Path p = Paths.get(new URI(potentialSourceURI)); if (Files.exists(p)) { return p; } } catch (URISyntaxException e) { e.printStackTrace(); } } } else if (uri.contains("target/test-classes")) { String[] testClassesTransform = { "src/test/java", "src/test/resources" }; for (String tct : testClassesTransform) { String potentialSourceURI = uri.replace("target/test-classes", tct); try { Path p = Paths.get(new URI(potentialSourceURI)); if (Files.exists(p)) { return p; } } catch (URISyntaxException e) { e.printStackTrace(); } } } }
logger(URIToPathConverters.class).debug("MAVEN converter failed to map css[%s] to a source file", uri);
McFoggy/cssfx
src/main/java/fr/brouillard/oss/cssfx/impl/ApplicationStages.java
// Path: src/main/java/fr/brouillard/oss/cssfx/impl/log/CSSFXLogger.java // public static Logger logger(String loggerName) { // if (!isInitialized()) { // noop(); // } // return loggerFactory.getLogger(loggerName); // }
import static java.util.stream.Collectors.toList; import static fr.brouillard.oss.cssfx.impl.log.CSSFXLogger.logger; import java.util.stream.Collectors; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.stage.Stage; import javafx.stage.Window;
package fr.brouillard.oss.cssfx.impl; /* * #%L * CSSFX * %% * Copyright (C) 2014 CSSFX by Matthieu Brouillard * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ public class ApplicationStages { /** * @deprecated do not use this method anymore, * @see Window#getWindows for similar functionnality */ @Deprecated(forRemoval = true, since = "11.0.2") public static ObservableList<Stage> monitoredStages(Stage ... restrictedTo) { try { ObservableList<Stage> stages = Window.getWindows().stream() .map(Stage.class::cast) .collect( Collectors.collectingAndThen(toList(), FXCollections::observableArrayList) );
// Path: src/main/java/fr/brouillard/oss/cssfx/impl/log/CSSFXLogger.java // public static Logger logger(String loggerName) { // if (!isInitialized()) { // noop(); // } // return loggerFactory.getLogger(loggerName); // } // Path: src/main/java/fr/brouillard/oss/cssfx/impl/ApplicationStages.java import static java.util.stream.Collectors.toList; import static fr.brouillard.oss.cssfx.impl.log.CSSFXLogger.logger; import java.util.stream.Collectors; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.stage.Stage; import javafx.stage.Window; package fr.brouillard.oss.cssfx.impl; /* * #%L * CSSFX * %% * Copyright (C) 2014 CSSFX by Matthieu Brouillard * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ public class ApplicationStages { /** * @deprecated do not use this method anymore, * @see Window#getWindows for similar functionnality */ @Deprecated(forRemoval = true, since = "11.0.2") public static ObservableList<Stage> monitoredStages(Stage ... restrictedTo) { try { ObservableList<Stage> stages = Window.getWindows().stream() .map(Stage.class::cast) .collect( Collectors.collectingAndThen(toList(), FXCollections::observableArrayList) );
logger(ApplicationStages.class).debug("successfully retrieved JavaFX stages by calling javafx.stage.Window.getWindows()");
macouen/lunzi
app/src/main/java/com/oakzmm/demoapp/view/WheelView.java
// Path: app/src/main/java/com/oakzmm/demoapp/utils/DensityUtil.java // public class DensityUtil { // // public static int dip2px(Context context, float dpValue) { // final float scale = context.getResources().getDisplayMetrics().density; // return (int) (dpValue * scale + 0.5f); // } // // public static int px2dip(Context context, float pxValue) { // final float scale = context.getResources().getDisplayMetrics().density; // return (int) (pxValue / scale + 0.5f); // } // // /** // * 获取控件的高度,如果获取的高度为0,则重新计算尺寸后再返回高度 // * // * @param view // * @return // */ // public static int getViewMeasuredHeight(View view) { // // int height = view.getMeasuredHeight(); // // if(0 < height){ // // return height; // // } // calcViewMeasure(view); // return view.getMeasuredHeight(); // } // // /** // * 获取控件的宽度,如果获取的宽度为0,则重新计算尺寸后再返回宽度 // * // * @param view // * @return // */ // public static int getViewMeasuredWidth(View view) { // // int width = view.getMeasuredWidth(); // // if(0 < width){ // // return width; // // } // calcViewMeasure(view); // return view.getMeasuredWidth(); // } // // /** // * 测量控件的尺寸 // * // * @param view // */ // public static void calcViewMeasure(View view) { // int width = View.MeasureSpec.makeMeasureSpec(0, // View.MeasureSpec.UNSPECIFIED); // int height = View.MeasureSpec.makeMeasureSpec(0, // View.MeasureSpec.UNSPECIFIED); // view.measure(width, height); // } // }
import android.app.Activity; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.ColorFilter; import android.graphics.Paint; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.Log; import android.util.TypedValue; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.ScrollView; import android.widget.TextView; import com.oakzmm.demoapp.utils.DensityUtil; import java.util.ArrayList; import java.util.List;
private void initData() { displayItemCount = offset * 2 + 1; selectedIndex = offset; views.removeAllViews(); for (String item : items) { views.addView(createView(item)); } refreshItemView(0); int childCount = views.getChildCount(); for (int i = 0; i < childCount; i++) { View view = views.getChildAt(i); view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (onItemClickListener != null) { onItemClickListener.onItemClick(getSelectedIndex()); } } }); } // views.postInvalidateDelayed(500); // init(context); } private TextView createView(String item) { final TextView tv = new TextView(context); tv.setLayoutParams(new LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT,
// Path: app/src/main/java/com/oakzmm/demoapp/utils/DensityUtil.java // public class DensityUtil { // // public static int dip2px(Context context, float dpValue) { // final float scale = context.getResources().getDisplayMetrics().density; // return (int) (dpValue * scale + 0.5f); // } // // public static int px2dip(Context context, float pxValue) { // final float scale = context.getResources().getDisplayMetrics().density; // return (int) (pxValue / scale + 0.5f); // } // // /** // * 获取控件的高度,如果获取的高度为0,则重新计算尺寸后再返回高度 // * // * @param view // * @return // */ // public static int getViewMeasuredHeight(View view) { // // int height = view.getMeasuredHeight(); // // if(0 < height){ // // return height; // // } // calcViewMeasure(view); // return view.getMeasuredHeight(); // } // // /** // * 获取控件的宽度,如果获取的宽度为0,则重新计算尺寸后再返回宽度 // * // * @param view // * @return // */ // public static int getViewMeasuredWidth(View view) { // // int width = view.getMeasuredWidth(); // // if(0 < width){ // // return width; // // } // calcViewMeasure(view); // return view.getMeasuredWidth(); // } // // /** // * 测量控件的尺寸 // * // * @param view // */ // public static void calcViewMeasure(View view) { // int width = View.MeasureSpec.makeMeasureSpec(0, // View.MeasureSpec.UNSPECIFIED); // int height = View.MeasureSpec.makeMeasureSpec(0, // View.MeasureSpec.UNSPECIFIED); // view.measure(width, height); // } // } // Path: app/src/main/java/com/oakzmm/demoapp/view/WheelView.java import android.app.Activity; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.ColorFilter; import android.graphics.Paint; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.Log; import android.util.TypedValue; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.ScrollView; import android.widget.TextView; import com.oakzmm.demoapp.utils.DensityUtil; import java.util.ArrayList; import java.util.List; private void initData() { displayItemCount = offset * 2 + 1; selectedIndex = offset; views.removeAllViews(); for (String item : items) { views.addView(createView(item)); } refreshItemView(0); int childCount = views.getChildCount(); for (int i = 0; i < childCount; i++) { View view = views.getChildAt(i); view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (onItemClickListener != null) { onItemClickListener.onItemClick(getSelectedIndex()); } } }); } // views.postInvalidateDelayed(500); // init(context); } private TextView createView(String item) { final TextView tv = new TextView(context); tv.setLayoutParams(new LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT,
DensityUtil.dip2px(context,50)));
macouen/lunzi
app/src/main/java/com/oakzmm/demoapp/zxing/camera/CameraManager.java
// Path: app/src/main/java/com/oakzmm/demoapp/utils/DensityUtil.java // public class DensityUtil { // // public static int dip2px(Context context, float dpValue) { // final float scale = context.getResources().getDisplayMetrics().density; // return (int) (dpValue * scale + 0.5f); // } // // public static int px2dip(Context context, float pxValue) { // final float scale = context.getResources().getDisplayMetrics().density; // return (int) (pxValue / scale + 0.5f); // } // // /** // * 获取控件的高度,如果获取的高度为0,则重新计算尺寸后再返回高度 // * // * @param view // * @return // */ // public static int getViewMeasuredHeight(View view) { // // int height = view.getMeasuredHeight(); // // if(0 < height){ // // return height; // // } // calcViewMeasure(view); // return view.getMeasuredHeight(); // } // // /** // * 获取控件的宽度,如果获取的宽度为0,则重新计算尺寸后再返回宽度 // * // * @param view // * @return // */ // public static int getViewMeasuredWidth(View view) { // // int width = view.getMeasuredWidth(); // // if(0 < width){ // // return width; // // } // calcViewMeasure(view); // return view.getMeasuredWidth(); // } // // /** // * 测量控件的尺寸 // * // * @param view // */ // public static void calcViewMeasure(View view) { // int width = View.MeasureSpec.makeMeasureSpec(0, // View.MeasureSpec.UNSPECIFIED); // int height = View.MeasureSpec.makeMeasureSpec(0, // View.MeasureSpec.UNSPECIFIED); // view.measure(width, height); // } // }
import android.content.Context; import android.graphics.PixelFormat; import android.graphics.Point; import android.graphics.Rect; import android.hardware.Camera; import android.os.Build; import android.os.Handler; import android.util.Log; import android.view.SurfaceHolder; import com.oakzmm.demoapp.utils.DensityUtil; import java.io.IOException;
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.oakzmm.demoapp.zxing.camera; /** * This object wraps the Camera service object and expects to be the only one talking to it. The * implementation encapsulates the steps needed to take preview-sized images, which are used for * both preview and decoding. */ public final class CameraManager { static final int SDK_INT; // Later we can use Build.VERSION.SDK_INT private static final String TAG = CameraManager.class.getSimpleName(); private static int MIN_FRAME_WIDTH = 200; private static int MIN_FRAME_HEIGHT = 200; private static int MAX_FRAME_WIDTH = 480; private static int MAX_FRAME_HEIGHT = 360; private static CameraManager cameraManager; static { int sdkInt; try { sdkInt = Integer.parseInt(Build.VERSION.SDK); } catch (NumberFormatException nfe) { // Just to be safe sdkInt = 10000; } SDK_INT = sdkInt; } private final Context context; private final CameraConfigurationManager configManager; private final boolean useOneShotPreviewCallback; /** * Preview frames are delivered here, which we pass on to the registered handler. Make sure to * clear the handler so it will only receive one message. */ private final PreviewCallback previewCallback; /** * Autofocus callbacks arrive here, and are dispatched to the Handler which requested them. */ private final AutoFocusCallback autoFocusCallback; private Camera camera; private Rect framingRect; private Rect framingRectInPreview; private boolean initialized; private boolean previewing; private CameraManager(Context context) {
// Path: app/src/main/java/com/oakzmm/demoapp/utils/DensityUtil.java // public class DensityUtil { // // public static int dip2px(Context context, float dpValue) { // final float scale = context.getResources().getDisplayMetrics().density; // return (int) (dpValue * scale + 0.5f); // } // // public static int px2dip(Context context, float pxValue) { // final float scale = context.getResources().getDisplayMetrics().density; // return (int) (pxValue / scale + 0.5f); // } // // /** // * 获取控件的高度,如果获取的高度为0,则重新计算尺寸后再返回高度 // * // * @param view // * @return // */ // public static int getViewMeasuredHeight(View view) { // // int height = view.getMeasuredHeight(); // // if(0 < height){ // // return height; // // } // calcViewMeasure(view); // return view.getMeasuredHeight(); // } // // /** // * 获取控件的宽度,如果获取的宽度为0,则重新计算尺寸后再返回宽度 // * // * @param view // * @return // */ // public static int getViewMeasuredWidth(View view) { // // int width = view.getMeasuredWidth(); // // if(0 < width){ // // return width; // // } // calcViewMeasure(view); // return view.getMeasuredWidth(); // } // // /** // * 测量控件的尺寸 // * // * @param view // */ // public static void calcViewMeasure(View view) { // int width = View.MeasureSpec.makeMeasureSpec(0, // View.MeasureSpec.UNSPECIFIED); // int height = View.MeasureSpec.makeMeasureSpec(0, // View.MeasureSpec.UNSPECIFIED); // view.measure(width, height); // } // } // Path: app/src/main/java/com/oakzmm/demoapp/zxing/camera/CameraManager.java import android.content.Context; import android.graphics.PixelFormat; import android.graphics.Point; import android.graphics.Rect; import android.hardware.Camera; import android.os.Build; import android.os.Handler; import android.util.Log; import android.view.SurfaceHolder; import com.oakzmm.demoapp.utils.DensityUtil; import java.io.IOException; /* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.oakzmm.demoapp.zxing.camera; /** * This object wraps the Camera service object and expects to be the only one talking to it. The * implementation encapsulates the steps needed to take preview-sized images, which are used for * both preview and decoding. */ public final class CameraManager { static final int SDK_INT; // Later we can use Build.VERSION.SDK_INT private static final String TAG = CameraManager.class.getSimpleName(); private static int MIN_FRAME_WIDTH = 200; private static int MIN_FRAME_HEIGHT = 200; private static int MAX_FRAME_WIDTH = 480; private static int MAX_FRAME_HEIGHT = 360; private static CameraManager cameraManager; static { int sdkInt; try { sdkInt = Integer.parseInt(Build.VERSION.SDK); } catch (NumberFormatException nfe) { // Just to be safe sdkInt = 10000; } SDK_INT = sdkInt; } private final Context context; private final CameraConfigurationManager configManager; private final boolean useOneShotPreviewCallback; /** * Preview frames are delivered here, which we pass on to the registered handler. Make sure to * clear the handler so it will only receive one message. */ private final PreviewCallback previewCallback; /** * Autofocus callbacks arrive here, and are dispatched to the Handler which requested them. */ private final AutoFocusCallback autoFocusCallback; private Camera camera; private Rect framingRect; private Rect framingRectInPreview; private boolean initialized; private boolean previewing; private CameraManager(Context context) {
MIN_FRAME_WIDTH = DensityUtil.dip2px(context, MIN_FRAME_WIDTH);
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/proxy/ClientRenderProxy.java
// Path: src/main/java/com/github/atomicblom/shearmadness/rendering/RenderChiselSheep.java // @SideOnly(Side.CLIENT) // public class RenderChiselSheep extends RenderLiving<EntitySheep> // { // private static final ResourceLocation SHEARED_SHEEP_TEXTURES = new ResourceLocation("textures/entity/sheep/sheep.png"); // // @SuppressWarnings("ThisEscapedInObjectConstruction") // public RenderChiselSheep(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) // { // super(renderManagerIn, modelBaseIn, shadowSizeIn); // addLayer(new LayerSheepChiselWool(this)); // } // // /** // * Returns the location of an rendering's texture. Doesn't seem to be called unless you call // * Render.bindEntityTexture. // */ // @Override // protected ResourceLocation getEntityTexture(EntitySheep entity) // { // return SHEARED_SHEEP_TEXTURES; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java // public final class Reference // { // public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; // public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; // public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + // "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + // "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + // "* CannotShear - You cannot shear the sheep while chiseled.\n"; // public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; // public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; // public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + // "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; // public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; // public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; // public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; // public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; // public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; // public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; // // private Reference() {} // // public static final class Blocks { // public static final String NORMAL_VARIANT = "normal"; // // public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone"); // public static final ResourceLocation InvisibleGlowstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleGlowstone"); // public static final ResourceLocation InvisibleBookshelf = new ResourceLocation(CommonReference.MOD_ID, "invisibleBookshelf"); // // private Blocks() {} // } // // }
import com.github.atomicblom.shearmadness.rendering.RenderChiselSheep; import com.github.atomicblom.shearmadness.utility.Reference; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelSheep2; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings("unused") public class ClientRenderProxy extends CommonRenderProxy { @Override public void registerRenderers() { final RenderManager renderManager = Minecraft.getMinecraft().getRenderManager(); renderManager.entityRenderMap.remove(EntitySheep.class);
// Path: src/main/java/com/github/atomicblom/shearmadness/rendering/RenderChiselSheep.java // @SideOnly(Side.CLIENT) // public class RenderChiselSheep extends RenderLiving<EntitySheep> // { // private static final ResourceLocation SHEARED_SHEEP_TEXTURES = new ResourceLocation("textures/entity/sheep/sheep.png"); // // @SuppressWarnings("ThisEscapedInObjectConstruction") // public RenderChiselSheep(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) // { // super(renderManagerIn, modelBaseIn, shadowSizeIn); // addLayer(new LayerSheepChiselWool(this)); // } // // /** // * Returns the location of an rendering's texture. Doesn't seem to be called unless you call // * Render.bindEntityTexture. // */ // @Override // protected ResourceLocation getEntityTexture(EntitySheep entity) // { // return SHEARED_SHEEP_TEXTURES; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java // public final class Reference // { // public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; // public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; // public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + // "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + // "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + // "* CannotShear - You cannot shear the sheep while chiseled.\n"; // public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; // public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; // public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + // "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; // public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; // public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; // public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; // public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; // public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; // public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; // // private Reference() {} // // public static final class Blocks { // public static final String NORMAL_VARIANT = "normal"; // // public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone"); // public static final ResourceLocation InvisibleGlowstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleGlowstone"); // public static final ResourceLocation InvisibleBookshelf = new ResourceLocation(CommonReference.MOD_ID, "invisibleBookshelf"); // // private Blocks() {} // } // // } // Path: src/main/java/com/github/atomicblom/shearmadness/proxy/ClientRenderProxy.java import com.github.atomicblom.shearmadness.rendering.RenderChiselSheep; import com.github.atomicblom.shearmadness.utility.Reference; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelSheep2; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings("unused") public class ClientRenderProxy extends CommonRenderProxy { @Override public void registerRenderers() { final RenderManager renderManager = Minecraft.getMinecraft().getRenderManager(); renderManager.entityRenderMap.remove(EntitySheep.class);
renderManager.entityRenderMap.put(EntitySheep.class, new RenderChiselSheep(renderManager, new ModelSheep2(), 0.7f));
AtomicBlom/ShearMadness
src/integration/java/com/github/atomicblom/shearmadness/variations/vanilla/behaviour/FollowAutoCraftItems.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/behaviour/BehaviourBase.java // @SuppressWarnings({"NoopMethodInAbstractClass", "ClassHasNoToStringMethod", "WeakerAccess"}) // public abstract class BehaviourBase<T extends BehaviourBase> { // private final EntitySheep entity; // private final Supplier<Boolean> configuration; // // protected BehaviourBase(EntitySheep sheep) { // this(sheep, () -> true); // } // // protected BehaviourBase(EntitySheep entity, Supplier<Boolean> configuration) // { // this.entity = entity; // this.configuration = configuration; // } // // public boolean isBehaviourEnabled() { // return configuration.get(); // } // // public void onSheepMovedBlock(BlockPos previousLocation, BlockPos newLocation) {} // // public void onBehaviourStarted(BlockPos currentPos) {} // // public void onBehaviourStopped(BlockPos previousPos) {} // // public void updateTask() {} // // public boolean isEquivalentTo(T other) { // return entity.getUniqueID().equals(other.getEntity().getUniqueID()); // } // // public EntitySheep getEntity() // { // return entity; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java // public enum Logger // { // INSTANCE; // // @SuppressWarnings({"NonSerializableFieldInSerializableClass", "InstanceVariableMayNotBeInitialized"}) // private org.apache.logging.log4j.Logger logger; // // public static void info(final String format, final Object... args) // { // INSTANCE.log(Level.INFO, format, args); // } // // public static void log(final Level level, final Throwable exception, final String format, final Object... args) // { // //noinspection ChainedMethodCall // INSTANCE.getLogger().log(level, String.format(format, args), exception); // } // // public static void severe(final String format, final Object... args) // { // INSTANCE.log(Level.ERROR, format, args); // } // // public static void warning(final String format, final Object... args) // { // INSTANCE.log(Level.WARN, format, args); // } // // public static void trace(final String format, final Object... args) // { // INSTANCE.log(Level.TRACE, format, args); // } // // private org.apache.logging.log4j.Logger getLogger() // { // if (logger == null) // { // init(); // } // // return logger; // } // // private void init() // { // if (logger == null) // { // logger = LogManager.getLogger(CommonReference.MOD_ID); // } // } // // private void log(final Level level, final String format, final Object... data) // { // //noinspection ChainedMethodCall // getLogger().log(level, String.format(format, data)); // } // }
import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.behaviour.BehaviourBase; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.utility.Logger; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ContainerWorkbench; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import javax.annotation.Nullable; import java.util.List;
package com.github.atomicblom.shearmadness.variations.vanilla.behaviour; public class FollowAutoCraftItems extends BehaviourBase<FollowAutoCraftItems> { private long lastExecutionTime; private int eatingItemTimer; private int poopingItemTimer; private EntityItem targetedItem; private long autocraftChangeTime; private ItemStack[] itemsToCollect = new ItemStack[9]; private ItemStack[] itemsConsumed = new ItemStack[9]; private ItemStack[] originalCraftingGrid = new ItemStack[9]; public FollowAutoCraftItems(EntitySheep entity) { super(entity); } @Override public void updateTask() { final EntitySheep entity = getEntity(); final World worldObj = entity.worldObj; if (eatingItemTimer > 0) { entity.getNavigator().clearPathEntity(); eatingItemTimer = Math.max(0, eatingItemTimer - 1); if (eatingItemTimer == 4) {
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/behaviour/BehaviourBase.java // @SuppressWarnings({"NoopMethodInAbstractClass", "ClassHasNoToStringMethod", "WeakerAccess"}) // public abstract class BehaviourBase<T extends BehaviourBase> { // private final EntitySheep entity; // private final Supplier<Boolean> configuration; // // protected BehaviourBase(EntitySheep sheep) { // this(sheep, () -> true); // } // // protected BehaviourBase(EntitySheep entity, Supplier<Boolean> configuration) // { // this.entity = entity; // this.configuration = configuration; // } // // public boolean isBehaviourEnabled() { // return configuration.get(); // } // // public void onSheepMovedBlock(BlockPos previousLocation, BlockPos newLocation) {} // // public void onBehaviourStarted(BlockPos currentPos) {} // // public void onBehaviourStopped(BlockPos previousPos) {} // // public void updateTask() {} // // public boolean isEquivalentTo(T other) { // return entity.getUniqueID().equals(other.getEntity().getUniqueID()); // } // // public EntitySheep getEntity() // { // return entity; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java // public enum Logger // { // INSTANCE; // // @SuppressWarnings({"NonSerializableFieldInSerializableClass", "InstanceVariableMayNotBeInitialized"}) // private org.apache.logging.log4j.Logger logger; // // public static void info(final String format, final Object... args) // { // INSTANCE.log(Level.INFO, format, args); // } // // public static void log(final Level level, final Throwable exception, final String format, final Object... args) // { // //noinspection ChainedMethodCall // INSTANCE.getLogger().log(level, String.format(format, args), exception); // } // // public static void severe(final String format, final Object... args) // { // INSTANCE.log(Level.ERROR, format, args); // } // // public static void warning(final String format, final Object... args) // { // INSTANCE.log(Level.WARN, format, args); // } // // public static void trace(final String format, final Object... args) // { // INSTANCE.log(Level.TRACE, format, args); // } // // private org.apache.logging.log4j.Logger getLogger() // { // if (logger == null) // { // init(); // } // // return logger; // } // // private void init() // { // if (logger == null) // { // logger = LogManager.getLogger(CommonReference.MOD_ID); // } // } // // private void log(final Level level, final String format, final Object... data) // { // //noinspection ChainedMethodCall // getLogger().log(level, String.format(format, data)); // } // } // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/vanilla/behaviour/FollowAutoCraftItems.java import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.behaviour.BehaviourBase; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.utility.Logger; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ContainerWorkbench; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import javax.annotation.Nullable; import java.util.List; package com.github.atomicblom.shearmadness.variations.vanilla.behaviour; public class FollowAutoCraftItems extends BehaviourBase<FollowAutoCraftItems> { private long lastExecutionTime; private int eatingItemTimer; private int poopingItemTimer; private EntityItem targetedItem; private long autocraftChangeTime; private ItemStack[] itemsToCollect = new ItemStack[9]; private ItemStack[] itemsConsumed = new ItemStack[9]; private ItemStack[] originalCraftingGrid = new ItemStack[9]; public FollowAutoCraftItems(EntitySheep entity) { super(entity); } @Override public void updateTask() { final EntitySheep entity = getEntity(); final World worldObj = entity.worldObj; if (eatingItemTimer > 0) { entity.getNavigator().clearPathEntity(); eatingItemTimer = Math.max(0, eatingItemTimer - 1); if (eatingItemTimer == 4) {
Logger.trace("Consuming Item");
AtomicBlom/ShearMadness
src/integration/java/com/github/atomicblom/shearmadness/variations/vanilla/behaviour/FollowAutoCraftItems.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/behaviour/BehaviourBase.java // @SuppressWarnings({"NoopMethodInAbstractClass", "ClassHasNoToStringMethod", "WeakerAccess"}) // public abstract class BehaviourBase<T extends BehaviourBase> { // private final EntitySheep entity; // private final Supplier<Boolean> configuration; // // protected BehaviourBase(EntitySheep sheep) { // this(sheep, () -> true); // } // // protected BehaviourBase(EntitySheep entity, Supplier<Boolean> configuration) // { // this.entity = entity; // this.configuration = configuration; // } // // public boolean isBehaviourEnabled() { // return configuration.get(); // } // // public void onSheepMovedBlock(BlockPos previousLocation, BlockPos newLocation) {} // // public void onBehaviourStarted(BlockPos currentPos) {} // // public void onBehaviourStopped(BlockPos previousPos) {} // // public void updateTask() {} // // public boolean isEquivalentTo(T other) { // return entity.getUniqueID().equals(other.getEntity().getUniqueID()); // } // // public EntitySheep getEntity() // { // return entity; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java // public enum Logger // { // INSTANCE; // // @SuppressWarnings({"NonSerializableFieldInSerializableClass", "InstanceVariableMayNotBeInitialized"}) // private org.apache.logging.log4j.Logger logger; // // public static void info(final String format, final Object... args) // { // INSTANCE.log(Level.INFO, format, args); // } // // public static void log(final Level level, final Throwable exception, final String format, final Object... args) // { // //noinspection ChainedMethodCall // INSTANCE.getLogger().log(level, String.format(format, args), exception); // } // // public static void severe(final String format, final Object... args) // { // INSTANCE.log(Level.ERROR, format, args); // } // // public static void warning(final String format, final Object... args) // { // INSTANCE.log(Level.WARN, format, args); // } // // public static void trace(final String format, final Object... args) // { // INSTANCE.log(Level.TRACE, format, args); // } // // private org.apache.logging.log4j.Logger getLogger() // { // if (logger == null) // { // init(); // } // // return logger; // } // // private void init() // { // if (logger == null) // { // logger = LogManager.getLogger(CommonReference.MOD_ID); // } // } // // private void log(final Level level, final String format, final Object... data) // { // //noinspection ChainedMethodCall // getLogger().log(level, String.format(format, data)); // } // }
import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.behaviour.BehaviourBase; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.utility.Logger; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ContainerWorkbench; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import javax.annotation.Nullable; import java.util.List;
Logger.trace("Consuming Item"); consumeItem(worldObj); } return; } final BlockPos position = entity.getPosition(); if (poopingItemTimer > 0) { entity.getNavigator().clearPathEntity(); poopingItemTimer = Math.max(0, poopingItemTimer - 1); if (poopingItemTimer == 1) { //calculate recipe and fire item out bum. Logger.trace("Crafting Item"); createItem(entity, worldObj); lastExecutionTime = worldObj.getTotalWorldTime(); } return; } if (lastExecutionTime + 20 < worldObj.getTotalWorldTime()) { lastExecutionTime = worldObj.getTotalWorldTime(); if (findItemToConsume(entity, worldObj, position)) return; Logger.trace("No items found"); } } private boolean findItemToConsume(EntitySheep entity, World worldObj, BlockPos position) {
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/behaviour/BehaviourBase.java // @SuppressWarnings({"NoopMethodInAbstractClass", "ClassHasNoToStringMethod", "WeakerAccess"}) // public abstract class BehaviourBase<T extends BehaviourBase> { // private final EntitySheep entity; // private final Supplier<Boolean> configuration; // // protected BehaviourBase(EntitySheep sheep) { // this(sheep, () -> true); // } // // protected BehaviourBase(EntitySheep entity, Supplier<Boolean> configuration) // { // this.entity = entity; // this.configuration = configuration; // } // // public boolean isBehaviourEnabled() { // return configuration.get(); // } // // public void onSheepMovedBlock(BlockPos previousLocation, BlockPos newLocation) {} // // public void onBehaviourStarted(BlockPos currentPos) {} // // public void onBehaviourStopped(BlockPos previousPos) {} // // public void updateTask() {} // // public boolean isEquivalentTo(T other) { // return entity.getUniqueID().equals(other.getEntity().getUniqueID()); // } // // public EntitySheep getEntity() // { // return entity; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java // public enum Logger // { // INSTANCE; // // @SuppressWarnings({"NonSerializableFieldInSerializableClass", "InstanceVariableMayNotBeInitialized"}) // private org.apache.logging.log4j.Logger logger; // // public static void info(final String format, final Object... args) // { // INSTANCE.log(Level.INFO, format, args); // } // // public static void log(final Level level, final Throwable exception, final String format, final Object... args) // { // //noinspection ChainedMethodCall // INSTANCE.getLogger().log(level, String.format(format, args), exception); // } // // public static void severe(final String format, final Object... args) // { // INSTANCE.log(Level.ERROR, format, args); // } // // public static void warning(final String format, final Object... args) // { // INSTANCE.log(Level.WARN, format, args); // } // // public static void trace(final String format, final Object... args) // { // INSTANCE.log(Level.TRACE, format, args); // } // // private org.apache.logging.log4j.Logger getLogger() // { // if (logger == null) // { // init(); // } // // return logger; // } // // private void init() // { // if (logger == null) // { // logger = LogManager.getLogger(CommonReference.MOD_ID); // } // } // // private void log(final Level level, final String format, final Object... data) // { // //noinspection ChainedMethodCall // getLogger().log(level, String.format(format, data)); // } // } // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/vanilla/behaviour/FollowAutoCraftItems.java import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.behaviour.BehaviourBase; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.utility.Logger; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ContainerWorkbench; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import javax.annotation.Nullable; import java.util.List; Logger.trace("Consuming Item"); consumeItem(worldObj); } return; } final BlockPos position = entity.getPosition(); if (poopingItemTimer > 0) { entity.getNavigator().clearPathEntity(); poopingItemTimer = Math.max(0, poopingItemTimer - 1); if (poopingItemTimer == 1) { //calculate recipe and fire item out bum. Logger.trace("Crafting Item"); createItem(entity, worldObj); lastExecutionTime = worldObj.getTotalWorldTime(); } return; } if (lastExecutionTime + 20 < worldObj.getTotalWorldTime()) { lastExecutionTime = worldObj.getTotalWorldTime(); if (findItemToConsume(entity, worldObj, position)) return; Logger.trace("No items found"); } } private boolean findItemToConsume(EntitySheep entity, World worldObj, BlockPos position) {
final IChiseledSheepCapability capability = entity.getCapability(Capability.CHISELED_SHEEP, null);
AtomicBlom/ShearMadness
src/integration/java/com/github/atomicblom/shearmadness/variations/vanilla/behaviour/FollowAutoCraftItems.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/behaviour/BehaviourBase.java // @SuppressWarnings({"NoopMethodInAbstractClass", "ClassHasNoToStringMethod", "WeakerAccess"}) // public abstract class BehaviourBase<T extends BehaviourBase> { // private final EntitySheep entity; // private final Supplier<Boolean> configuration; // // protected BehaviourBase(EntitySheep sheep) { // this(sheep, () -> true); // } // // protected BehaviourBase(EntitySheep entity, Supplier<Boolean> configuration) // { // this.entity = entity; // this.configuration = configuration; // } // // public boolean isBehaviourEnabled() { // return configuration.get(); // } // // public void onSheepMovedBlock(BlockPos previousLocation, BlockPos newLocation) {} // // public void onBehaviourStarted(BlockPos currentPos) {} // // public void onBehaviourStopped(BlockPos previousPos) {} // // public void updateTask() {} // // public boolean isEquivalentTo(T other) { // return entity.getUniqueID().equals(other.getEntity().getUniqueID()); // } // // public EntitySheep getEntity() // { // return entity; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java // public enum Logger // { // INSTANCE; // // @SuppressWarnings({"NonSerializableFieldInSerializableClass", "InstanceVariableMayNotBeInitialized"}) // private org.apache.logging.log4j.Logger logger; // // public static void info(final String format, final Object... args) // { // INSTANCE.log(Level.INFO, format, args); // } // // public static void log(final Level level, final Throwable exception, final String format, final Object... args) // { // //noinspection ChainedMethodCall // INSTANCE.getLogger().log(level, String.format(format, args), exception); // } // // public static void severe(final String format, final Object... args) // { // INSTANCE.log(Level.ERROR, format, args); // } // // public static void warning(final String format, final Object... args) // { // INSTANCE.log(Level.WARN, format, args); // } // // public static void trace(final String format, final Object... args) // { // INSTANCE.log(Level.TRACE, format, args); // } // // private org.apache.logging.log4j.Logger getLogger() // { // if (logger == null) // { // init(); // } // // return logger; // } // // private void init() // { // if (logger == null) // { // logger = LogManager.getLogger(CommonReference.MOD_ID); // } // } // // private void log(final Level level, final String format, final Object... data) // { // //noinspection ChainedMethodCall // getLogger().log(level, String.format(format, data)); // } // }
import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.behaviour.BehaviourBase; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.utility.Logger; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ContainerWorkbench; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import javax.annotation.Nullable; import java.util.List;
Logger.trace("Consuming Item"); consumeItem(worldObj); } return; } final BlockPos position = entity.getPosition(); if (poopingItemTimer > 0) { entity.getNavigator().clearPathEntity(); poopingItemTimer = Math.max(0, poopingItemTimer - 1); if (poopingItemTimer == 1) { //calculate recipe and fire item out bum. Logger.trace("Crafting Item"); createItem(entity, worldObj); lastExecutionTime = worldObj.getTotalWorldTime(); } return; } if (lastExecutionTime + 20 < worldObj.getTotalWorldTime()) { lastExecutionTime = worldObj.getTotalWorldTime(); if (findItemToConsume(entity, worldObj, position)) return; Logger.trace("No items found"); } } private boolean findItemToConsume(EntitySheep entity, World worldObj, BlockPos position) {
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/behaviour/BehaviourBase.java // @SuppressWarnings({"NoopMethodInAbstractClass", "ClassHasNoToStringMethod", "WeakerAccess"}) // public abstract class BehaviourBase<T extends BehaviourBase> { // private final EntitySheep entity; // private final Supplier<Boolean> configuration; // // protected BehaviourBase(EntitySheep sheep) { // this(sheep, () -> true); // } // // protected BehaviourBase(EntitySheep entity, Supplier<Boolean> configuration) // { // this.entity = entity; // this.configuration = configuration; // } // // public boolean isBehaviourEnabled() { // return configuration.get(); // } // // public void onSheepMovedBlock(BlockPos previousLocation, BlockPos newLocation) {} // // public void onBehaviourStarted(BlockPos currentPos) {} // // public void onBehaviourStopped(BlockPos previousPos) {} // // public void updateTask() {} // // public boolean isEquivalentTo(T other) { // return entity.getUniqueID().equals(other.getEntity().getUniqueID()); // } // // public EntitySheep getEntity() // { // return entity; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java // public enum Logger // { // INSTANCE; // // @SuppressWarnings({"NonSerializableFieldInSerializableClass", "InstanceVariableMayNotBeInitialized"}) // private org.apache.logging.log4j.Logger logger; // // public static void info(final String format, final Object... args) // { // INSTANCE.log(Level.INFO, format, args); // } // // public static void log(final Level level, final Throwable exception, final String format, final Object... args) // { // //noinspection ChainedMethodCall // INSTANCE.getLogger().log(level, String.format(format, args), exception); // } // // public static void severe(final String format, final Object... args) // { // INSTANCE.log(Level.ERROR, format, args); // } // // public static void warning(final String format, final Object... args) // { // INSTANCE.log(Level.WARN, format, args); // } // // public static void trace(final String format, final Object... args) // { // INSTANCE.log(Level.TRACE, format, args); // } // // private org.apache.logging.log4j.Logger getLogger() // { // if (logger == null) // { // init(); // } // // return logger; // } // // private void init() // { // if (logger == null) // { // logger = LogManager.getLogger(CommonReference.MOD_ID); // } // } // // private void log(final Level level, final String format, final Object... data) // { // //noinspection ChainedMethodCall // getLogger().log(level, String.format(format, data)); // } // } // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/vanilla/behaviour/FollowAutoCraftItems.java import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.behaviour.BehaviourBase; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.utility.Logger; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ContainerWorkbench; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import javax.annotation.Nullable; import java.util.List; Logger.trace("Consuming Item"); consumeItem(worldObj); } return; } final BlockPos position = entity.getPosition(); if (poopingItemTimer > 0) { entity.getNavigator().clearPathEntity(); poopingItemTimer = Math.max(0, poopingItemTimer - 1); if (poopingItemTimer == 1) { //calculate recipe and fire item out bum. Logger.trace("Crafting Item"); createItem(entity, worldObj); lastExecutionTime = worldObj.getTotalWorldTime(); } return; } if (lastExecutionTime + 20 < worldObj.getTotalWorldTime()) { lastExecutionTime = worldObj.getTotalWorldTime(); if (findItemToConsume(entity, worldObj, position)) return; Logger.trace("No items found"); } } private boolean findItemToConsume(EntitySheep entity, World worldObj, BlockPos position) {
final IChiseledSheepCapability capability = entity.getCapability(Capability.CHISELED_SHEEP, null);
AtomicBlom/ShearMadness
src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/capability/ChanceCubeParticipationCapabilityProvider.java
// Path: src/main/java/com/github/atomicblom/shearmadness/capability/ChiseledSheepCapability.java // public class ChiseledSheepCapability implements IChiseledSheepCapability, IWriteExtraData // { // @Nullable // private ItemStack itemStack = null; // private int itemIdentifier; // private NBTTagCompound customData = null; // // @Override // public boolean isChiseled() // { // return itemStack != null; // } // // @Override // public void chisel(@Nonnull ItemStack itemStack) // { // this.itemStack = itemStack; // itemIdentifier = ItemStackUtils.getHash(itemStack); // } // // @Override // public void unChisel() { // itemStack = null; // itemIdentifier = 0; // } // // @Override // public ItemStack getChiselItemStack() // { // return itemStack; // } // // @Override // public int getItemIdentifier() // { // return itemIdentifier; // } // // @Override // public NBTTagCompound getExtraData() { // if (customData == null) { // customData = new NBTTagCompound(); // } // return customData; // } // // @Override // public void setExtraData(NBTTagCompound extraData) { // customData = extraData; // } // // @Override // public String toString() // { // return Objects.toStringHelper(this) // .add("itemIdentifier", itemIdentifier) // .add("itemStack", itemStack) // .add("isChiseled", isChiseled()) // .toString(); // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/capability/ChiseledSheepCapabilityStorage.java // public class ChiseledSheepCapabilityStorage implements IStorage<IChiseledSheepCapability> // { // public static final IStorage<IChiseledSheepCapability> instance = new ChiseledSheepCapabilityStorage(); // // @Override // public NBTBase writeNBT(Capability<IChiseledSheepCapability> capability, IChiseledSheepCapability instance, EnumFacing side) // { // final NBTTagCompound compound = new NBTTagCompound(); // compound.setBoolean("isChiseled", instance.isChiseled()); // if (instance.isChiseled()) // { // final NBTTagCompound targetTag = new NBTTagCompound(); // instance.getChiselItemStack().writeToNBT(targetTag); // compound.setTag("chiselDefinition", targetTag); // } // // final NBTTagCompound extraData = instance.getExtraData(); // compound.setTag("extraData", extraData); // return compound; // } // // @Override // public void readNBT(Capability<IChiseledSheepCapability> capability, IChiseledSheepCapability instance, EnumFacing side, NBTBase nbt) // { // final NBTTagCompound compound = (NBTTagCompound) nbt; // // final boolean isChiseled = compound.getBoolean("isChiseled"); // if (isChiseled) // { // final ItemStack stack = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("chiselDefinition")); // instance.chisel(stack); // } // // if (instance instanceof IWriteExtraData) { // ((IWriteExtraData) instance).setExtraData(compound.getCompoundTag("extraData")); // } // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/ChanceCubesReference.java // @CapabilityInject(IChanceCubeParticipationCapability.class) // public static final Capability<IChanceCubeParticipationCapability> CHANCE_CUBE_PARTICIPATION;
import com.github.atomicblom.shearmadness.capability.ChiseledSheepCapability; import com.github.atomicblom.shearmadness.capability.ChiseledSheepCapabilityStorage; import net.minecraft.nbt.NBTBase; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.util.INBTSerializable; import javax.annotation.Nullable; import static com.github.atomicblom.shearmadness.variations.chancecubes.ChanceCubesReference.CHANCE_CUBE_PARTICIPATION;
package com.github.atomicblom.shearmadness.variations.chancecubes.capability; /** * Created by codew on 1/03/2017. */ public class ChanceCubeParticipationCapabilityProvider implements ICapabilityProvider, INBTSerializable<NBTBase> { private final ChanceCubeParticipationCapability capability; public ChanceCubeParticipationCapabilityProvider() { capability = new ChanceCubeParticipationCapability(); } @Override public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
// Path: src/main/java/com/github/atomicblom/shearmadness/capability/ChiseledSheepCapability.java // public class ChiseledSheepCapability implements IChiseledSheepCapability, IWriteExtraData // { // @Nullable // private ItemStack itemStack = null; // private int itemIdentifier; // private NBTTagCompound customData = null; // // @Override // public boolean isChiseled() // { // return itemStack != null; // } // // @Override // public void chisel(@Nonnull ItemStack itemStack) // { // this.itemStack = itemStack; // itemIdentifier = ItemStackUtils.getHash(itemStack); // } // // @Override // public void unChisel() { // itemStack = null; // itemIdentifier = 0; // } // // @Override // public ItemStack getChiselItemStack() // { // return itemStack; // } // // @Override // public int getItemIdentifier() // { // return itemIdentifier; // } // // @Override // public NBTTagCompound getExtraData() { // if (customData == null) { // customData = new NBTTagCompound(); // } // return customData; // } // // @Override // public void setExtraData(NBTTagCompound extraData) { // customData = extraData; // } // // @Override // public String toString() // { // return Objects.toStringHelper(this) // .add("itemIdentifier", itemIdentifier) // .add("itemStack", itemStack) // .add("isChiseled", isChiseled()) // .toString(); // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/capability/ChiseledSheepCapabilityStorage.java // public class ChiseledSheepCapabilityStorage implements IStorage<IChiseledSheepCapability> // { // public static final IStorage<IChiseledSheepCapability> instance = new ChiseledSheepCapabilityStorage(); // // @Override // public NBTBase writeNBT(Capability<IChiseledSheepCapability> capability, IChiseledSheepCapability instance, EnumFacing side) // { // final NBTTagCompound compound = new NBTTagCompound(); // compound.setBoolean("isChiseled", instance.isChiseled()); // if (instance.isChiseled()) // { // final NBTTagCompound targetTag = new NBTTagCompound(); // instance.getChiselItemStack().writeToNBT(targetTag); // compound.setTag("chiselDefinition", targetTag); // } // // final NBTTagCompound extraData = instance.getExtraData(); // compound.setTag("extraData", extraData); // return compound; // } // // @Override // public void readNBT(Capability<IChiseledSheepCapability> capability, IChiseledSheepCapability instance, EnumFacing side, NBTBase nbt) // { // final NBTTagCompound compound = (NBTTagCompound) nbt; // // final boolean isChiseled = compound.getBoolean("isChiseled"); // if (isChiseled) // { // final ItemStack stack = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("chiselDefinition")); // instance.chisel(stack); // } // // if (instance instanceof IWriteExtraData) { // ((IWriteExtraData) instance).setExtraData(compound.getCompoundTag("extraData")); // } // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/ChanceCubesReference.java // @CapabilityInject(IChanceCubeParticipationCapability.class) // public static final Capability<IChanceCubeParticipationCapability> CHANCE_CUBE_PARTICIPATION; // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/capability/ChanceCubeParticipationCapabilityProvider.java import com.github.atomicblom.shearmadness.capability.ChiseledSheepCapability; import com.github.atomicblom.shearmadness.capability.ChiseledSheepCapabilityStorage; import net.minecraft.nbt.NBTBase; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.util.INBTSerializable; import javax.annotation.Nullable; import static com.github.atomicblom.shearmadness.variations.chancecubes.ChanceCubesReference.CHANCE_CUBE_PARTICIPATION; package com.github.atomicblom.shearmadness.variations.chancecubes.capability; /** * Created by codew on 1/03/2017. */ public class ChanceCubeParticipationCapabilityProvider implements ICapabilityProvider, INBTSerializable<NBTBase> { private final ChanceCubeParticipationCapability capability; public ChanceCubeParticipationCapabilityProvider() { capability = new ChanceCubeParticipationCapability(); } @Override public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
return capability == CHANCE_CUBE_PARTICIPATION;
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java
// Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // }
import com.github.atomicblom.shearmadness.variations.CommonReference; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager;
public static void severe(final String format, final Object... args) { INSTANCE.log(Level.ERROR, format, args); } public static void warning(final String format, final Object... args) { INSTANCE.log(Level.WARN, format, args); } public static void trace(final String format, final Object... args) { INSTANCE.log(Level.TRACE, format, args); } private org.apache.logging.log4j.Logger getLogger() { if (logger == null) { init(); } return logger; } private void init() { if (logger == null) {
// Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // } // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java import com.github.atomicblom.shearmadness.variations.CommonReference; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; public static void severe(final String format, final Object... args) { INSTANCE.log(Level.ERROR, format, args); } public static void warning(final String format, final Object... args) { INSTANCE.log(Level.WARN, format, args); } public static void trace(final String format, final Object... args) { INSTANCE.log(Level.TRACE, format, args); } private org.apache.logging.log4j.Logger getLogger() { if (logger == null) { init(); } return logger; } private void init() { if (logger == null) {
logger = LogManager.getLogger(CommonReference.MOD_ID);
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/events/RegistryEventHandler.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/ICustomParticleFactory.java // public interface ICustomParticleFactory extends IForgeRegistryEntry<ICustomParticleFactory> { // @SideOnly(Side.CLIENT) // IParticleFactory getParticleFactory(); // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // }
import com.github.atomicblom.shearmadness.api.particles.ICustomParticleFactory; import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraft.util.ResourceLocation; import net.minecraftforge.event.RegistryEvent.NewRegistry; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.RegistryBuilder;
package com.github.atomicblom.shearmadness.events; @Mod.EventBusSubscriber public final class RegistryEventHandler { @SubscribeEvent public static void onCreateRegistry(NewRegistry event) {
// Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/ICustomParticleFactory.java // public interface ICustomParticleFactory extends IForgeRegistryEntry<ICustomParticleFactory> { // @SideOnly(Side.CLIENT) // IParticleFactory getParticleFactory(); // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // } // Path: src/main/java/com/github/atomicblom/shearmadness/events/RegistryEventHandler.java import com.github.atomicblom.shearmadness.api.particles.ICustomParticleFactory; import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraft.util.ResourceLocation; import net.minecraftforge.event.RegistryEvent.NewRegistry; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.RegistryBuilder; package com.github.atomicblom.shearmadness.events; @Mod.EventBusSubscriber public final class RegistryEventHandler { @SubscribeEvent public static void onCreateRegistry(NewRegistry event) {
new RegistryBuilder<ICustomParticleFactory>()
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/events/RegistryEventHandler.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/ICustomParticleFactory.java // public interface ICustomParticleFactory extends IForgeRegistryEntry<ICustomParticleFactory> { // @SideOnly(Side.CLIENT) // IParticleFactory getParticleFactory(); // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // }
import com.github.atomicblom.shearmadness.api.particles.ICustomParticleFactory; import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraft.util.ResourceLocation; import net.minecraftforge.event.RegistryEvent.NewRegistry; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.RegistryBuilder;
package com.github.atomicblom.shearmadness.events; @Mod.EventBusSubscriber public final class RegistryEventHandler { @SubscribeEvent public static void onCreateRegistry(NewRegistry event) { new RegistryBuilder<ICustomParticleFactory>() .setType(ICustomParticleFactory.class)
// Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/ICustomParticleFactory.java // public interface ICustomParticleFactory extends IForgeRegistryEntry<ICustomParticleFactory> { // @SideOnly(Side.CLIENT) // IParticleFactory getParticleFactory(); // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // } // Path: src/main/java/com/github/atomicblom/shearmadness/events/RegistryEventHandler.java import com.github.atomicblom.shearmadness.api.particles.ICustomParticleFactory; import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraft.util.ResourceLocation; import net.minecraftforge.event.RegistryEvent.NewRegistry; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.RegistryBuilder; package com.github.atomicblom.shearmadness.events; @Mod.EventBusSubscriber public final class RegistryEventHandler { @SubscribeEvent public static void onCreateRegistry(NewRegistry event) { new RegistryBuilder<ICustomParticleFactory>() .setType(ICustomParticleFactory.class)
.setName(new ResourceLocation(CommonReference.MOD_ID, "custom_particles"))
AtomicBlom/ShearMadness
src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/client/SheepHeadParticle.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/CustomParticleFactoryBase.java // public abstract class CustomParticleFactoryBase implements ICustomParticleFactory { // private ResourceLocation registryName; // // @SideOnly(Side.CLIENT) // private IParticleFactory factory; // // @Override // @SideOnly(Side.CLIENT) // public IParticleFactory getParticleFactory() { // if (factory == null) { // factory = (particleID, worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, parameters) -> createCustomParticle(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, parameters); // } // return factory; // } // // @SideOnly(Side.CLIENT) // protected abstract Particle createCustomParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_); // // @Override // public ICustomParticleFactory setRegistryName(ResourceLocation name) { // registryName = name; // return this; // } // // @Override // public ResourceLocation getRegistryName() { // return registryName; // } // // @Override // public Class<? super ICustomParticleFactory> getRegistryType() { // return ICustomParticleFactory.class; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/ICustomParticleFactory.java // public interface ICustomParticleFactory extends IForgeRegistryEntry<ICustomParticleFactory> { // @SideOnly(Side.CLIENT) // IParticleFactory getParticleFactory(); // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/ChanceCubesLibrary.java // @ObjectHolder(ChanceCubesReference.CHANCE_CUBES_MODID) // public class ChanceCubesLibrary // { // @ObjectHolder("chance_Cube") // public static final Block chance_cube; // // @ObjectHolder("chance_Icosahedron") // public static final Block chance_icosadedron; // // @ObjectHolder("compact_Giant_Chance_Cube") // public static final Block chance_cube_giant_compact; // // @ObjectHolder("giant_Chance_Cube") // public static final Block chance_cube_giant; // // static { // chance_cube = null; // chance_icosadedron = null; // chance_cube_giant = null; // chance_cube_giant_compact = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP;
import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.api.particles.CustomParticleFactoryBase; import com.github.atomicblom.shearmadness.api.particles.ICustomParticleFactory; import com.github.atomicblom.shearmadness.variations.chancecubes.ChanceCubesLibrary; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.IParticleFactory; import net.minecraft.client.particle.Particle; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityGuardian; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.item.ItemStack; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import static com.github.atomicblom.shearmadness.api.Capability.CHISELED_SHEEP;
package com.github.atomicblom.shearmadness.variations.chancecubes.client; @SideOnly(Side.CLIENT) public class SheepHeadParticle extends Particle { private EntityLivingBase entity; protected SheepHeadParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn) { super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); this.particleRed = 1.0F; this.particleGreen = 1.0F; this.particleBlue = 1.0F; this.motionX = 0.0D; this.motionY = 0.0D; this.motionZ = 0.0D; this.particleGravity = 0.0F; this.particleMaxAge = 30; } /** * Retrieve what effect layer (what texture) the particle should be rendered with. 0 for the particle sprite sheet, * 1 for the main Texture atlas, and 3 for a custom texture */ public int getFXLayer() { return 3; } public void onUpdate() { super.onUpdate(); if (this.entity == null) { this.entity = new EntitySheep(this.worldObj);
// Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/CustomParticleFactoryBase.java // public abstract class CustomParticleFactoryBase implements ICustomParticleFactory { // private ResourceLocation registryName; // // @SideOnly(Side.CLIENT) // private IParticleFactory factory; // // @Override // @SideOnly(Side.CLIENT) // public IParticleFactory getParticleFactory() { // if (factory == null) { // factory = (particleID, worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, parameters) -> createCustomParticle(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, parameters); // } // return factory; // } // // @SideOnly(Side.CLIENT) // protected abstract Particle createCustomParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_); // // @Override // public ICustomParticleFactory setRegistryName(ResourceLocation name) { // registryName = name; // return this; // } // // @Override // public ResourceLocation getRegistryName() { // return registryName; // } // // @Override // public Class<? super ICustomParticleFactory> getRegistryType() { // return ICustomParticleFactory.class; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/ICustomParticleFactory.java // public interface ICustomParticleFactory extends IForgeRegistryEntry<ICustomParticleFactory> { // @SideOnly(Side.CLIENT) // IParticleFactory getParticleFactory(); // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/ChanceCubesLibrary.java // @ObjectHolder(ChanceCubesReference.CHANCE_CUBES_MODID) // public class ChanceCubesLibrary // { // @ObjectHolder("chance_Cube") // public static final Block chance_cube; // // @ObjectHolder("chance_Icosahedron") // public static final Block chance_icosadedron; // // @ObjectHolder("compact_Giant_Chance_Cube") // public static final Block chance_cube_giant_compact; // // @ObjectHolder("giant_Chance_Cube") // public static final Block chance_cube_giant; // // static { // chance_cube = null; // chance_icosadedron = null; // chance_cube_giant = null; // chance_cube_giant_compact = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/client/SheepHeadParticle.java import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.api.particles.CustomParticleFactoryBase; import com.github.atomicblom.shearmadness.api.particles.ICustomParticleFactory; import com.github.atomicblom.shearmadness.variations.chancecubes.ChanceCubesLibrary; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.IParticleFactory; import net.minecraft.client.particle.Particle; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityGuardian; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.item.ItemStack; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import static com.github.atomicblom.shearmadness.api.Capability.CHISELED_SHEEP; package com.github.atomicblom.shearmadness.variations.chancecubes.client; @SideOnly(Side.CLIENT) public class SheepHeadParticle extends Particle { private EntityLivingBase entity; protected SheepHeadParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn) { super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); this.particleRed = 1.0F; this.particleGreen = 1.0F; this.particleBlue = 1.0F; this.motionX = 0.0D; this.motionY = 0.0D; this.motionZ = 0.0D; this.particleGravity = 0.0F; this.particleMaxAge = 30; } /** * Retrieve what effect layer (what texture) the particle should be rendered with. 0 for the particle sprite sheet, * 1 for the main Texture atlas, and 3 for a custom texture */ public int getFXLayer() { return 3; } public void onUpdate() { super.onUpdate(); if (this.entity == null) { this.entity = new EntitySheep(this.worldObj);
if (entity.hasCapability(CHISELED_SHEEP, null)) {
AtomicBlom/ShearMadness
src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/client/SheepHeadParticle.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/CustomParticleFactoryBase.java // public abstract class CustomParticleFactoryBase implements ICustomParticleFactory { // private ResourceLocation registryName; // // @SideOnly(Side.CLIENT) // private IParticleFactory factory; // // @Override // @SideOnly(Side.CLIENT) // public IParticleFactory getParticleFactory() { // if (factory == null) { // factory = (particleID, worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, parameters) -> createCustomParticle(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, parameters); // } // return factory; // } // // @SideOnly(Side.CLIENT) // protected abstract Particle createCustomParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_); // // @Override // public ICustomParticleFactory setRegistryName(ResourceLocation name) { // registryName = name; // return this; // } // // @Override // public ResourceLocation getRegistryName() { // return registryName; // } // // @Override // public Class<? super ICustomParticleFactory> getRegistryType() { // return ICustomParticleFactory.class; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/ICustomParticleFactory.java // public interface ICustomParticleFactory extends IForgeRegistryEntry<ICustomParticleFactory> { // @SideOnly(Side.CLIENT) // IParticleFactory getParticleFactory(); // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/ChanceCubesLibrary.java // @ObjectHolder(ChanceCubesReference.CHANCE_CUBES_MODID) // public class ChanceCubesLibrary // { // @ObjectHolder("chance_Cube") // public static final Block chance_cube; // // @ObjectHolder("chance_Icosahedron") // public static final Block chance_icosadedron; // // @ObjectHolder("compact_Giant_Chance_Cube") // public static final Block chance_cube_giant_compact; // // @ObjectHolder("giant_Chance_Cube") // public static final Block chance_cube_giant; // // static { // chance_cube = null; // chance_icosadedron = null; // chance_cube_giant = null; // chance_cube_giant_compact = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP;
import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.api.particles.CustomParticleFactoryBase; import com.github.atomicblom.shearmadness.api.particles.ICustomParticleFactory; import com.github.atomicblom.shearmadness.variations.chancecubes.ChanceCubesLibrary; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.IParticleFactory; import net.minecraft.client.particle.Particle; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityGuardian; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.item.ItemStack; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import static com.github.atomicblom.shearmadness.api.Capability.CHISELED_SHEEP;
package com.github.atomicblom.shearmadness.variations.chancecubes.client; @SideOnly(Side.CLIENT) public class SheepHeadParticle extends Particle { private EntityLivingBase entity; protected SheepHeadParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn) { super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); this.particleRed = 1.0F; this.particleGreen = 1.0F; this.particleBlue = 1.0F; this.motionX = 0.0D; this.motionY = 0.0D; this.motionZ = 0.0D; this.particleGravity = 0.0F; this.particleMaxAge = 30; } /** * Retrieve what effect layer (what texture) the particle should be rendered with. 0 for the particle sprite sheet, * 1 for the main Texture atlas, and 3 for a custom texture */ public int getFXLayer() { return 3; } public void onUpdate() { super.onUpdate(); if (this.entity == null) { this.entity = new EntitySheep(this.worldObj); if (entity.hasCapability(CHISELED_SHEEP, null)) {
// Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/CustomParticleFactoryBase.java // public abstract class CustomParticleFactoryBase implements ICustomParticleFactory { // private ResourceLocation registryName; // // @SideOnly(Side.CLIENT) // private IParticleFactory factory; // // @Override // @SideOnly(Side.CLIENT) // public IParticleFactory getParticleFactory() { // if (factory == null) { // factory = (particleID, worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, parameters) -> createCustomParticle(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, parameters); // } // return factory; // } // // @SideOnly(Side.CLIENT) // protected abstract Particle createCustomParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_); // // @Override // public ICustomParticleFactory setRegistryName(ResourceLocation name) { // registryName = name; // return this; // } // // @Override // public ResourceLocation getRegistryName() { // return registryName; // } // // @Override // public Class<? super ICustomParticleFactory> getRegistryType() { // return ICustomParticleFactory.class; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/ICustomParticleFactory.java // public interface ICustomParticleFactory extends IForgeRegistryEntry<ICustomParticleFactory> { // @SideOnly(Side.CLIENT) // IParticleFactory getParticleFactory(); // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/ChanceCubesLibrary.java // @ObjectHolder(ChanceCubesReference.CHANCE_CUBES_MODID) // public class ChanceCubesLibrary // { // @ObjectHolder("chance_Cube") // public static final Block chance_cube; // // @ObjectHolder("chance_Icosahedron") // public static final Block chance_icosadedron; // // @ObjectHolder("compact_Giant_Chance_Cube") // public static final Block chance_cube_giant_compact; // // @ObjectHolder("giant_Chance_Cube") // public static final Block chance_cube_giant; // // static { // chance_cube = null; // chance_icosadedron = null; // chance_cube_giant = null; // chance_cube_giant_compact = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/client/SheepHeadParticle.java import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.api.particles.CustomParticleFactoryBase; import com.github.atomicblom.shearmadness.api.particles.ICustomParticleFactory; import com.github.atomicblom.shearmadness.variations.chancecubes.ChanceCubesLibrary; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.IParticleFactory; import net.minecraft.client.particle.Particle; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityGuardian; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.item.ItemStack; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import static com.github.atomicblom.shearmadness.api.Capability.CHISELED_SHEEP; package com.github.atomicblom.shearmadness.variations.chancecubes.client; @SideOnly(Side.CLIENT) public class SheepHeadParticle extends Particle { private EntityLivingBase entity; protected SheepHeadParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn) { super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); this.particleRed = 1.0F; this.particleGreen = 1.0F; this.particleBlue = 1.0F; this.motionX = 0.0D; this.motionY = 0.0D; this.motionZ = 0.0D; this.particleGravity = 0.0F; this.particleMaxAge = 30; } /** * Retrieve what effect layer (what texture) the particle should be rendered with. 0 for the particle sprite sheet, * 1 for the main Texture atlas, and 3 for a custom texture */ public int getFXLayer() { return 3; } public void onUpdate() { super.onUpdate(); if (this.entity == null) { this.entity = new EntitySheep(this.worldObj); if (entity.hasCapability(CHISELED_SHEEP, null)) {
IChiseledSheepCapability capability = entity.getCapability(CHISELED_SHEEP, null);
AtomicBlom/ShearMadness
src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/client/SheepHeadParticle.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/CustomParticleFactoryBase.java // public abstract class CustomParticleFactoryBase implements ICustomParticleFactory { // private ResourceLocation registryName; // // @SideOnly(Side.CLIENT) // private IParticleFactory factory; // // @Override // @SideOnly(Side.CLIENT) // public IParticleFactory getParticleFactory() { // if (factory == null) { // factory = (particleID, worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, parameters) -> createCustomParticle(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, parameters); // } // return factory; // } // // @SideOnly(Side.CLIENT) // protected abstract Particle createCustomParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_); // // @Override // public ICustomParticleFactory setRegistryName(ResourceLocation name) { // registryName = name; // return this; // } // // @Override // public ResourceLocation getRegistryName() { // return registryName; // } // // @Override // public Class<? super ICustomParticleFactory> getRegistryType() { // return ICustomParticleFactory.class; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/ICustomParticleFactory.java // public interface ICustomParticleFactory extends IForgeRegistryEntry<ICustomParticleFactory> { // @SideOnly(Side.CLIENT) // IParticleFactory getParticleFactory(); // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/ChanceCubesLibrary.java // @ObjectHolder(ChanceCubesReference.CHANCE_CUBES_MODID) // public class ChanceCubesLibrary // { // @ObjectHolder("chance_Cube") // public static final Block chance_cube; // // @ObjectHolder("chance_Icosahedron") // public static final Block chance_icosadedron; // // @ObjectHolder("compact_Giant_Chance_Cube") // public static final Block chance_cube_giant_compact; // // @ObjectHolder("giant_Chance_Cube") // public static final Block chance_cube_giant; // // static { // chance_cube = null; // chance_icosadedron = null; // chance_cube_giant = null; // chance_cube_giant_compact = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP;
import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.api.particles.CustomParticleFactoryBase; import com.github.atomicblom.shearmadness.api.particles.ICustomParticleFactory; import com.github.atomicblom.shearmadness.variations.chancecubes.ChanceCubesLibrary; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.IParticleFactory; import net.minecraft.client.particle.Particle; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityGuardian; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.item.ItemStack; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import static com.github.atomicblom.shearmadness.api.Capability.CHISELED_SHEEP;
package com.github.atomicblom.shearmadness.variations.chancecubes.client; @SideOnly(Side.CLIENT) public class SheepHeadParticle extends Particle { private EntityLivingBase entity; protected SheepHeadParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn) { super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); this.particleRed = 1.0F; this.particleGreen = 1.0F; this.particleBlue = 1.0F; this.motionX = 0.0D; this.motionY = 0.0D; this.motionZ = 0.0D; this.particleGravity = 0.0F; this.particleMaxAge = 30; } /** * Retrieve what effect layer (what texture) the particle should be rendered with. 0 for the particle sprite sheet, * 1 for the main Texture atlas, and 3 for a custom texture */ public int getFXLayer() { return 3; } public void onUpdate() { super.onUpdate(); if (this.entity == null) { this.entity = new EntitySheep(this.worldObj); if (entity.hasCapability(CHISELED_SHEEP, null)) { IChiseledSheepCapability capability = entity.getCapability(CHISELED_SHEEP, null);
// Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/CustomParticleFactoryBase.java // public abstract class CustomParticleFactoryBase implements ICustomParticleFactory { // private ResourceLocation registryName; // // @SideOnly(Side.CLIENT) // private IParticleFactory factory; // // @Override // @SideOnly(Side.CLIENT) // public IParticleFactory getParticleFactory() { // if (factory == null) { // factory = (particleID, worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, parameters) -> createCustomParticle(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, parameters); // } // return factory; // } // // @SideOnly(Side.CLIENT) // protected abstract Particle createCustomParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_); // // @Override // public ICustomParticleFactory setRegistryName(ResourceLocation name) { // registryName = name; // return this; // } // // @Override // public ResourceLocation getRegistryName() { // return registryName; // } // // @Override // public Class<? super ICustomParticleFactory> getRegistryType() { // return ICustomParticleFactory.class; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/ICustomParticleFactory.java // public interface ICustomParticleFactory extends IForgeRegistryEntry<ICustomParticleFactory> { // @SideOnly(Side.CLIENT) // IParticleFactory getParticleFactory(); // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/ChanceCubesLibrary.java // @ObjectHolder(ChanceCubesReference.CHANCE_CUBES_MODID) // public class ChanceCubesLibrary // { // @ObjectHolder("chance_Cube") // public static final Block chance_cube; // // @ObjectHolder("chance_Icosahedron") // public static final Block chance_icosadedron; // // @ObjectHolder("compact_Giant_Chance_Cube") // public static final Block chance_cube_giant_compact; // // @ObjectHolder("giant_Chance_Cube") // public static final Block chance_cube_giant; // // static { // chance_cube = null; // chance_icosadedron = null; // chance_cube_giant = null; // chance_cube_giant_compact = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/client/SheepHeadParticle.java import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.api.particles.CustomParticleFactoryBase; import com.github.atomicblom.shearmadness.api.particles.ICustomParticleFactory; import com.github.atomicblom.shearmadness.variations.chancecubes.ChanceCubesLibrary; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.IParticleFactory; import net.minecraft.client.particle.Particle; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityGuardian; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.item.ItemStack; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import static com.github.atomicblom.shearmadness.api.Capability.CHISELED_SHEEP; package com.github.atomicblom.shearmadness.variations.chancecubes.client; @SideOnly(Side.CLIENT) public class SheepHeadParticle extends Particle { private EntityLivingBase entity; protected SheepHeadParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn) { super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); this.particleRed = 1.0F; this.particleGreen = 1.0F; this.particleBlue = 1.0F; this.motionX = 0.0D; this.motionY = 0.0D; this.motionZ = 0.0D; this.particleGravity = 0.0F; this.particleMaxAge = 30; } /** * Retrieve what effect layer (what texture) the particle should be rendered with. 0 for the particle sprite sheet, * 1 for the main Texture atlas, and 3 for a custom texture */ public int getFXLayer() { return 3; } public void onUpdate() { super.onUpdate(); if (this.entity == null) { this.entity = new EntitySheep(this.worldObj); if (entity.hasCapability(CHISELED_SHEEP, null)) { IChiseledSheepCapability capability = entity.getCapability(CHISELED_SHEEP, null);
capability.chisel(new ItemStack(ChanceCubesLibrary.chance_cube, 1));
AtomicBlom/ShearMadness
src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/client/SheepHeadParticle.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/CustomParticleFactoryBase.java // public abstract class CustomParticleFactoryBase implements ICustomParticleFactory { // private ResourceLocation registryName; // // @SideOnly(Side.CLIENT) // private IParticleFactory factory; // // @Override // @SideOnly(Side.CLIENT) // public IParticleFactory getParticleFactory() { // if (factory == null) { // factory = (particleID, worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, parameters) -> createCustomParticle(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, parameters); // } // return factory; // } // // @SideOnly(Side.CLIENT) // protected abstract Particle createCustomParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_); // // @Override // public ICustomParticleFactory setRegistryName(ResourceLocation name) { // registryName = name; // return this; // } // // @Override // public ResourceLocation getRegistryName() { // return registryName; // } // // @Override // public Class<? super ICustomParticleFactory> getRegistryType() { // return ICustomParticleFactory.class; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/ICustomParticleFactory.java // public interface ICustomParticleFactory extends IForgeRegistryEntry<ICustomParticleFactory> { // @SideOnly(Side.CLIENT) // IParticleFactory getParticleFactory(); // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/ChanceCubesLibrary.java // @ObjectHolder(ChanceCubesReference.CHANCE_CUBES_MODID) // public class ChanceCubesLibrary // { // @ObjectHolder("chance_Cube") // public static final Block chance_cube; // // @ObjectHolder("chance_Icosahedron") // public static final Block chance_icosadedron; // // @ObjectHolder("compact_Giant_Chance_Cube") // public static final Block chance_cube_giant_compact; // // @ObjectHolder("giant_Chance_Cube") // public static final Block chance_cube_giant; // // static { // chance_cube = null; // chance_icosadedron = null; // chance_cube_giant = null; // chance_cube_giant_compact = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP;
import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.api.particles.CustomParticleFactoryBase; import com.github.atomicblom.shearmadness.api.particles.ICustomParticleFactory; import com.github.atomicblom.shearmadness.variations.chancecubes.ChanceCubesLibrary; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.IParticleFactory; import net.minecraft.client.particle.Particle; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityGuardian; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.item.ItemStack; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import static com.github.atomicblom.shearmadness.api.Capability.CHISELED_SHEEP;
float particleAge = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge; GlStateManager.depthMask(true); GlStateManager.enableBlend(); GlStateManager.enableDepth(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); float lightLevel = 240.0F; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightLevel, lightLevel); GlStateManager.pushMatrix(); float alpha = 0.05F + 0.5F * MathHelper.sin(particleAge * (float)Math.PI); GlStateManager.color(1.0F, 1.0F, 1.0F, alpha); GlStateManager.translate(0.0F, 1.8F, 0.0F); GlStateManager.rotate(180.0F - entityIn.rotationYaw, 0.0F, 1.0F, 0.0F); float speed = 150.0F; GlStateManager.rotate(260 - (60.0F - speed * particleAge - entityIn.rotationPitch), 1.0F, 0.0F, 0.0F); float scale = 1.2F; GlStateManager.translate(0.0F, -0.4F, -2.2); GlStateManager.rotate(30.0f, 1.0F, 0.0F, 0.0F); GlStateManager.scale(scale, scale, scale); this.entity.rotationYaw = 0.0F; this.entity.rotationYawHead = 0.0F; this.entity.prevRotationYaw = 0.0F; this.entity.prevRotationYawHead = 0.0F; rendermanager.doRenderEntity(this.entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks, false); GlStateManager.popMatrix(); GlStateManager.enableDepth(); } }
// Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/CustomParticleFactoryBase.java // public abstract class CustomParticleFactoryBase implements ICustomParticleFactory { // private ResourceLocation registryName; // // @SideOnly(Side.CLIENT) // private IParticleFactory factory; // // @Override // @SideOnly(Side.CLIENT) // public IParticleFactory getParticleFactory() { // if (factory == null) { // factory = (particleID, worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, parameters) -> createCustomParticle(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, parameters); // } // return factory; // } // // @SideOnly(Side.CLIENT) // protected abstract Particle createCustomParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_); // // @Override // public ICustomParticleFactory setRegistryName(ResourceLocation name) { // registryName = name; // return this; // } // // @Override // public ResourceLocation getRegistryName() { // return registryName; // } // // @Override // public Class<? super ICustomParticleFactory> getRegistryType() { // return ICustomParticleFactory.class; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/ICustomParticleFactory.java // public interface ICustomParticleFactory extends IForgeRegistryEntry<ICustomParticleFactory> { // @SideOnly(Side.CLIENT) // IParticleFactory getParticleFactory(); // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/ChanceCubesLibrary.java // @ObjectHolder(ChanceCubesReference.CHANCE_CUBES_MODID) // public class ChanceCubesLibrary // { // @ObjectHolder("chance_Cube") // public static final Block chance_cube; // // @ObjectHolder("chance_Icosahedron") // public static final Block chance_icosadedron; // // @ObjectHolder("compact_Giant_Chance_Cube") // public static final Block chance_cube_giant_compact; // // @ObjectHolder("giant_Chance_Cube") // public static final Block chance_cube_giant; // // static { // chance_cube = null; // chance_icosadedron = null; // chance_cube_giant = null; // chance_cube_giant_compact = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/client/SheepHeadParticle.java import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.api.particles.CustomParticleFactoryBase; import com.github.atomicblom.shearmadness.api.particles.ICustomParticleFactory; import com.github.atomicblom.shearmadness.variations.chancecubes.ChanceCubesLibrary; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.IParticleFactory; import net.minecraft.client.particle.Particle; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityGuardian; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.item.ItemStack; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import static com.github.atomicblom.shearmadness.api.Capability.CHISELED_SHEEP; float particleAge = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge; GlStateManager.depthMask(true); GlStateManager.enableBlend(); GlStateManager.enableDepth(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); float lightLevel = 240.0F; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightLevel, lightLevel); GlStateManager.pushMatrix(); float alpha = 0.05F + 0.5F * MathHelper.sin(particleAge * (float)Math.PI); GlStateManager.color(1.0F, 1.0F, 1.0F, alpha); GlStateManager.translate(0.0F, 1.8F, 0.0F); GlStateManager.rotate(180.0F - entityIn.rotationYaw, 0.0F, 1.0F, 0.0F); float speed = 150.0F; GlStateManager.rotate(260 - (60.0F - speed * particleAge - entityIn.rotationPitch), 1.0F, 0.0F, 0.0F); float scale = 1.2F; GlStateManager.translate(0.0F, -0.4F, -2.2); GlStateManager.rotate(30.0f, 1.0F, 0.0F, 0.0F); GlStateManager.scale(scale, scale, scale); this.entity.rotationYaw = 0.0F; this.entity.rotationYawHead = 0.0F; this.entity.prevRotationYaw = 0.0F; this.entity.prevRotationYawHead = 0.0F; rendermanager.doRenderEntity(this.entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks, false); GlStateManager.popMatrix(); GlStateManager.enableDepth(); } }
public static class Factory extends CustomParticleFactoryBase
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/networking/SpawnCustomParticleMessageHandler.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/ICustomParticleFactory.java // public interface ICustomParticleFactory extends IForgeRegistryEntry<ICustomParticleFactory> { // @SideOnly(Side.CLIENT) // IParticleFactory getParticleFactory(); // }
import com.github.atomicblom.shearmadness.api.particles.ICustomParticleFactory; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.ParticleManager; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.IForgeRegistry;
package com.github.atomicblom.shearmadness.networking; public class SpawnCustomParticleMessageHandler implements IMessageHandler<SpawnCustomParticleMessage, IMessage> { @SuppressWarnings({"ReturnOfNull", "ConstantConditions"}) @Override public IMessage onMessage(SpawnCustomParticleMessage message, MessageContext ctx) { final ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
// Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/ICustomParticleFactory.java // public interface ICustomParticleFactory extends IForgeRegistryEntry<ICustomParticleFactory> { // @SideOnly(Side.CLIENT) // IParticleFactory getParticleFactory(); // } // Path: src/main/java/com/github/atomicblom/shearmadness/networking/SpawnCustomParticleMessageHandler.java import com.github.atomicblom.shearmadness.api.particles.ICustomParticleFactory; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.ParticleManager; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.IForgeRegistry; package com.github.atomicblom.shearmadness.networking; public class SpawnCustomParticleMessageHandler implements IMessageHandler<SpawnCustomParticleMessage, IMessage> { @SuppressWarnings({"ReturnOfNull", "ConstantConditions"}) @Override public IMessage onMessage(SpawnCustomParticleMessage message, MessageContext ctx) { final ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
final IForgeRegistry<ICustomParticleFactory> registry = GameRegistry.findRegistry(ICustomParticleFactory.class);
AtomicBlom/ShearMadness
src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/ChanceCubesConfiguration.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/events/ShearMadnessSyncSettingsEvent.java // public class ShearMadnessSyncSettingsEvent extends Event { // private Configuration config; // // public ShearMadnessSyncSettingsEvent(Configuration config) { // // this.config = config; // } // // public Configuration getConfig() { // return config; // } // }
import com.github.atomicblom.shearmadness.api.events.ShearMadnessSyncSettingsEvent; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
package com.github.atomicblom.shearmadness.variations.chancecubes; @Mod.EventBusSubscriber public final class ChanceCubesConfiguration { public static Property enabled; public static Property distance; @SubscribeEvent
// Path: src/api/java/com/github/atomicblom/shearmadness/api/events/ShearMadnessSyncSettingsEvent.java // public class ShearMadnessSyncSettingsEvent extends Event { // private Configuration config; // // public ShearMadnessSyncSettingsEvent(Configuration config) { // // this.config = config; // } // // public Configuration getConfig() { // return config; // } // } // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/ChanceCubesConfiguration.java import com.github.atomicblom.shearmadness.api.events.ShearMadnessSyncSettingsEvent; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; package com.github.atomicblom.shearmadness.variations.chancecubes; @Mod.EventBusSubscriber public final class ChanceCubesConfiguration { public static Property enabled; public static Property distance; @SubscribeEvent
public static void onConfigSync(ShearMadnessSyncSettingsEvent event) {
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/networking/SheepChiseledMessage.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/capability/CapabilityProvider.java // @SuppressWarnings({"ObjectEquality", "ConstantConditions", "ClassHasNoToStringMethod"}) // public class CapabilityProvider implements ICapabilityProvider, INBTSerializable<NBTBase> // { // private final IChiseledSheepCapability capability; // // public CapabilityProvider() // { // capability = new ChiseledSheepCapability(); // } // // @Override // public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) // { // return capability == CHISELED_SHEEP; // } // // @Override // public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) // { // if (capability == CHISELED_SHEEP) // { // return CHISELED_SHEEP.cast(this.capability); // } // //noinspection ReturnOfNull // return null; // } // // @Override // public NBTBase serializeNBT() // { // return ChiseledSheepCapabilityStorage.instance.writeNBT(CHISELED_SHEEP, capability, null); // } // // @Override // public void deserializeNBT(NBTBase nbt) // { // ChiseledSheepCapabilityStorage.instance.readNBT(CHISELED_SHEEP, capability, null, nbt); // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // }
import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.capability.CapabilityProvider; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.google.common.base.Objects; import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.network.ByteBufUtils; import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
package com.github.atomicblom.shearmadness.networking; public class SheepChiseledMessage implements IMessage { private int sheepId; private boolean isChiseled; private ItemStack itemStack = null; @SuppressWarnings("unused") public SheepChiseledMessage() {} public SheepChiseledMessage(Entity sheep) { sheepId = sheep.getEntityId();
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/capability/CapabilityProvider.java // @SuppressWarnings({"ObjectEquality", "ConstantConditions", "ClassHasNoToStringMethod"}) // public class CapabilityProvider implements ICapabilityProvider, INBTSerializable<NBTBase> // { // private final IChiseledSheepCapability capability; // // public CapabilityProvider() // { // capability = new ChiseledSheepCapability(); // } // // @Override // public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) // { // return capability == CHISELED_SHEEP; // } // // @Override // public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) // { // if (capability == CHISELED_SHEEP) // { // return CHISELED_SHEEP.cast(this.capability); // } // //noinspection ReturnOfNull // return null; // } // // @Override // public NBTBase serializeNBT() // { // return ChiseledSheepCapabilityStorage.instance.writeNBT(CHISELED_SHEEP, capability, null); // } // // @Override // public void deserializeNBT(NBTBase nbt) // { // ChiseledSheepCapabilityStorage.instance.readNBT(CHISELED_SHEEP, capability, null, nbt); // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // Path: src/main/java/com/github/atomicblom/shearmadness/networking/SheepChiseledMessage.java import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.capability.CapabilityProvider; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.google.common.base.Objects; import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.network.ByteBufUtils; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; package com.github.atomicblom.shearmadness.networking; public class SheepChiseledMessage implements IMessage { private int sheepId; private boolean isChiseled; private ItemStack itemStack = null; @SuppressWarnings("unused") public SheepChiseledMessage() {} public SheepChiseledMessage(Entity sheep) { sheepId = sheep.getEntityId();
final IChiseledSheepCapability capability = sheep.getCapability(Capability.CHISELED_SHEEP, null);
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/networking/SheepChiseledMessage.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/capability/CapabilityProvider.java // @SuppressWarnings({"ObjectEquality", "ConstantConditions", "ClassHasNoToStringMethod"}) // public class CapabilityProvider implements ICapabilityProvider, INBTSerializable<NBTBase> // { // private final IChiseledSheepCapability capability; // // public CapabilityProvider() // { // capability = new ChiseledSheepCapability(); // } // // @Override // public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) // { // return capability == CHISELED_SHEEP; // } // // @Override // public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) // { // if (capability == CHISELED_SHEEP) // { // return CHISELED_SHEEP.cast(this.capability); // } // //noinspection ReturnOfNull // return null; // } // // @Override // public NBTBase serializeNBT() // { // return ChiseledSheepCapabilityStorage.instance.writeNBT(CHISELED_SHEEP, capability, null); // } // // @Override // public void deserializeNBT(NBTBase nbt) // { // ChiseledSheepCapabilityStorage.instance.readNBT(CHISELED_SHEEP, capability, null, nbt); // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // }
import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.capability.CapabilityProvider; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.google.common.base.Objects; import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.network.ByteBufUtils; import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
package com.github.atomicblom.shearmadness.networking; public class SheepChiseledMessage implements IMessage { private int sheepId; private boolean isChiseled; private ItemStack itemStack = null; @SuppressWarnings("unused") public SheepChiseledMessage() {} public SheepChiseledMessage(Entity sheep) { sheepId = sheep.getEntityId();
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/capability/CapabilityProvider.java // @SuppressWarnings({"ObjectEquality", "ConstantConditions", "ClassHasNoToStringMethod"}) // public class CapabilityProvider implements ICapabilityProvider, INBTSerializable<NBTBase> // { // private final IChiseledSheepCapability capability; // // public CapabilityProvider() // { // capability = new ChiseledSheepCapability(); // } // // @Override // public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) // { // return capability == CHISELED_SHEEP; // } // // @Override // public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) // { // if (capability == CHISELED_SHEEP) // { // return CHISELED_SHEEP.cast(this.capability); // } // //noinspection ReturnOfNull // return null; // } // // @Override // public NBTBase serializeNBT() // { // return ChiseledSheepCapabilityStorage.instance.writeNBT(CHISELED_SHEEP, capability, null); // } // // @Override // public void deserializeNBT(NBTBase nbt) // { // ChiseledSheepCapabilityStorage.instance.readNBT(CHISELED_SHEEP, capability, null, nbt); // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // Path: src/main/java/com/github/atomicblom/shearmadness/networking/SheepChiseledMessage.java import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.capability.CapabilityProvider; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.google.common.base.Objects; import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.network.ByteBufUtils; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; package com.github.atomicblom.shearmadness.networking; public class SheepChiseledMessage implements IMessage { private int sheepId; private boolean isChiseled; private ItemStack itemStack = null; @SuppressWarnings("unused") public SheepChiseledMessage() {} public SheepChiseledMessage(Entity sheep) { sheepId = sheep.getEntityId();
final IChiseledSheepCapability capability = sheep.getCapability(Capability.CHISELED_SHEEP, null);
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/proxy/ClientForgeEventProxy.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/events/RegisterShearMadnessVariationEvent.java // @SideOnly(Side.CLIENT) // public class RegisterShearMadnessVariationEvent extends Event // { // private final IVariationRegistry registry; // // public RegisterShearMadnessVariationEvent(IVariationRegistry registry) { // // this.registry = registry; // } // // /** // * @return A registry to declare variation against. // */ // public IVariationRegistry getRegistry() // { // return registry; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/api/VariationRegistry.java // @SideOnly(Side.CLIENT) // public class VariationRegistry implements IVariationRegistry // { // public static final VariationRegistry INSTANCE = new VariationRegistry(); // // private VariationRegistry() {} // // private final List<ShearMadnessVariation> variations = new LinkedList<>(); // // private final IModelMaker defaultHandler = new DefaultModelMaker(); // // @Override // public void registerVariation(Function<ItemStack, Boolean> handlesVariant, IModelMaker variationModelMaker) { // variations.add(new ShearMadnessVariation(handlesVariant, variationModelMaker)); // } // // @Override // public void registerVariation(Function<ItemStack, Boolean> handlesVariant, QuadrupedTransformDefinition transformDefinition) // { // variations.add(new ShearMadnessVariation(handlesVariant, new DefaultModelMaker(transformDefinition))); // } // // public IModelMaker getVariationModelMaker(ItemStack itemStack) { // IModelMaker handler = null; // for (final ShearMadnessVariation variation : variations) // { // if (variation.canHandleItemStack(itemStack)) { // handler = variation.getVariationModelMaker(); // break; // } // } // if (handler == null) { // handler = defaultHandler; // } // // return handler; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/networking/CheckSheepChiseledRequestMessage.java // public class CheckSheepChiseledRequestMessage implements IMessage // { // private String sheepUUID = null; // // @SuppressWarnings("unused") // public CheckSheepChiseledRequestMessage() {} // // public CheckSheepChiseledRequestMessage(Entity sheep) // { // sheepUUID = sheep.getCachedUniqueIdString(); // } // // @Override // public void fromBytes(ByteBuf buf) // { // sheepUUID = ByteBufUtils.readUTF8String(buf); // // } // // @Override // public void toBytes(ByteBuf buf) // { // ByteBufUtils.writeUTF8String(buf, sheepUUID); // } // // String getSheepUUID() // { // return sheepUUID; // } // // @Override // public String toString() // { // return Objects.toStringHelper(this) // .add("sheepUUID", sheepUUID) // .toString(); // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // } // // Path: src/main/java/com/github/atomicblom/shearmadness/ShearMadnessMod.java // public static final SimpleNetworkWrapper CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel(CommonReference.MOD_ID);
import com.github.atomicblom.shearmadness.api.events.RegisterShearMadnessVariationEvent; import com.github.atomicblom.shearmadness.api.VariationRegistry; import com.github.atomicblom.shearmadness.networking.CheckSheepChiseledRequestMessage; import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraft.entity.Entity; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import static com.github.atomicblom.shearmadness.ShearMadnessMod.CHANNEL;
package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings({"MethodMayBeStatic", "unused"}) public class ClientForgeEventProxy extends CommonForgeEventProxy { @Override public void fireRegistryEvent() {
// Path: src/api/java/com/github/atomicblom/shearmadness/api/events/RegisterShearMadnessVariationEvent.java // @SideOnly(Side.CLIENT) // public class RegisterShearMadnessVariationEvent extends Event // { // private final IVariationRegistry registry; // // public RegisterShearMadnessVariationEvent(IVariationRegistry registry) { // // this.registry = registry; // } // // /** // * @return A registry to declare variation against. // */ // public IVariationRegistry getRegistry() // { // return registry; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/api/VariationRegistry.java // @SideOnly(Side.CLIENT) // public class VariationRegistry implements IVariationRegistry // { // public static final VariationRegistry INSTANCE = new VariationRegistry(); // // private VariationRegistry() {} // // private final List<ShearMadnessVariation> variations = new LinkedList<>(); // // private final IModelMaker defaultHandler = new DefaultModelMaker(); // // @Override // public void registerVariation(Function<ItemStack, Boolean> handlesVariant, IModelMaker variationModelMaker) { // variations.add(new ShearMadnessVariation(handlesVariant, variationModelMaker)); // } // // @Override // public void registerVariation(Function<ItemStack, Boolean> handlesVariant, QuadrupedTransformDefinition transformDefinition) // { // variations.add(new ShearMadnessVariation(handlesVariant, new DefaultModelMaker(transformDefinition))); // } // // public IModelMaker getVariationModelMaker(ItemStack itemStack) { // IModelMaker handler = null; // for (final ShearMadnessVariation variation : variations) // { // if (variation.canHandleItemStack(itemStack)) { // handler = variation.getVariationModelMaker(); // break; // } // } // if (handler == null) { // handler = defaultHandler; // } // // return handler; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/networking/CheckSheepChiseledRequestMessage.java // public class CheckSheepChiseledRequestMessage implements IMessage // { // private String sheepUUID = null; // // @SuppressWarnings("unused") // public CheckSheepChiseledRequestMessage() {} // // public CheckSheepChiseledRequestMessage(Entity sheep) // { // sheepUUID = sheep.getCachedUniqueIdString(); // } // // @Override // public void fromBytes(ByteBuf buf) // { // sheepUUID = ByteBufUtils.readUTF8String(buf); // // } // // @Override // public void toBytes(ByteBuf buf) // { // ByteBufUtils.writeUTF8String(buf, sheepUUID); // } // // String getSheepUUID() // { // return sheepUUID; // } // // @Override // public String toString() // { // return Objects.toStringHelper(this) // .add("sheepUUID", sheepUUID) // .toString(); // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // } // // Path: src/main/java/com/github/atomicblom/shearmadness/ShearMadnessMod.java // public static final SimpleNetworkWrapper CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel(CommonReference.MOD_ID); // Path: src/main/java/com/github/atomicblom/shearmadness/proxy/ClientForgeEventProxy.java import com.github.atomicblom.shearmadness.api.events.RegisterShearMadnessVariationEvent; import com.github.atomicblom.shearmadness.api.VariationRegistry; import com.github.atomicblom.shearmadness.networking.CheckSheepChiseledRequestMessage; import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraft.entity.Entity; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import static com.github.atomicblom.shearmadness.ShearMadnessMod.CHANNEL; package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings({"MethodMayBeStatic", "unused"}) public class ClientForgeEventProxy extends CommonForgeEventProxy { @Override public void fireRegistryEvent() {
MinecraftForge.EVENT_BUS.post(new RegisterShearMadnessVariationEvent(VariationRegistry.INSTANCE));
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/proxy/ClientForgeEventProxy.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/events/RegisterShearMadnessVariationEvent.java // @SideOnly(Side.CLIENT) // public class RegisterShearMadnessVariationEvent extends Event // { // private final IVariationRegistry registry; // // public RegisterShearMadnessVariationEvent(IVariationRegistry registry) { // // this.registry = registry; // } // // /** // * @return A registry to declare variation against. // */ // public IVariationRegistry getRegistry() // { // return registry; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/api/VariationRegistry.java // @SideOnly(Side.CLIENT) // public class VariationRegistry implements IVariationRegistry // { // public static final VariationRegistry INSTANCE = new VariationRegistry(); // // private VariationRegistry() {} // // private final List<ShearMadnessVariation> variations = new LinkedList<>(); // // private final IModelMaker defaultHandler = new DefaultModelMaker(); // // @Override // public void registerVariation(Function<ItemStack, Boolean> handlesVariant, IModelMaker variationModelMaker) { // variations.add(new ShearMadnessVariation(handlesVariant, variationModelMaker)); // } // // @Override // public void registerVariation(Function<ItemStack, Boolean> handlesVariant, QuadrupedTransformDefinition transformDefinition) // { // variations.add(new ShearMadnessVariation(handlesVariant, new DefaultModelMaker(transformDefinition))); // } // // public IModelMaker getVariationModelMaker(ItemStack itemStack) { // IModelMaker handler = null; // for (final ShearMadnessVariation variation : variations) // { // if (variation.canHandleItemStack(itemStack)) { // handler = variation.getVariationModelMaker(); // break; // } // } // if (handler == null) { // handler = defaultHandler; // } // // return handler; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/networking/CheckSheepChiseledRequestMessage.java // public class CheckSheepChiseledRequestMessage implements IMessage // { // private String sheepUUID = null; // // @SuppressWarnings("unused") // public CheckSheepChiseledRequestMessage() {} // // public CheckSheepChiseledRequestMessage(Entity sheep) // { // sheepUUID = sheep.getCachedUniqueIdString(); // } // // @Override // public void fromBytes(ByteBuf buf) // { // sheepUUID = ByteBufUtils.readUTF8String(buf); // // } // // @Override // public void toBytes(ByteBuf buf) // { // ByteBufUtils.writeUTF8String(buf, sheepUUID); // } // // String getSheepUUID() // { // return sheepUUID; // } // // @Override // public String toString() // { // return Objects.toStringHelper(this) // .add("sheepUUID", sheepUUID) // .toString(); // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // } // // Path: src/main/java/com/github/atomicblom/shearmadness/ShearMadnessMod.java // public static final SimpleNetworkWrapper CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel(CommonReference.MOD_ID);
import com.github.atomicblom.shearmadness.api.events.RegisterShearMadnessVariationEvent; import com.github.atomicblom.shearmadness.api.VariationRegistry; import com.github.atomicblom.shearmadness.networking.CheckSheepChiseledRequestMessage; import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraft.entity.Entity; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import static com.github.atomicblom.shearmadness.ShearMadnessMod.CHANNEL;
package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings({"MethodMayBeStatic", "unused"}) public class ClientForgeEventProxy extends CommonForgeEventProxy { @Override public void fireRegistryEvent() {
// Path: src/api/java/com/github/atomicblom/shearmadness/api/events/RegisterShearMadnessVariationEvent.java // @SideOnly(Side.CLIENT) // public class RegisterShearMadnessVariationEvent extends Event // { // private final IVariationRegistry registry; // // public RegisterShearMadnessVariationEvent(IVariationRegistry registry) { // // this.registry = registry; // } // // /** // * @return A registry to declare variation against. // */ // public IVariationRegistry getRegistry() // { // return registry; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/api/VariationRegistry.java // @SideOnly(Side.CLIENT) // public class VariationRegistry implements IVariationRegistry // { // public static final VariationRegistry INSTANCE = new VariationRegistry(); // // private VariationRegistry() {} // // private final List<ShearMadnessVariation> variations = new LinkedList<>(); // // private final IModelMaker defaultHandler = new DefaultModelMaker(); // // @Override // public void registerVariation(Function<ItemStack, Boolean> handlesVariant, IModelMaker variationModelMaker) { // variations.add(new ShearMadnessVariation(handlesVariant, variationModelMaker)); // } // // @Override // public void registerVariation(Function<ItemStack, Boolean> handlesVariant, QuadrupedTransformDefinition transformDefinition) // { // variations.add(new ShearMadnessVariation(handlesVariant, new DefaultModelMaker(transformDefinition))); // } // // public IModelMaker getVariationModelMaker(ItemStack itemStack) { // IModelMaker handler = null; // for (final ShearMadnessVariation variation : variations) // { // if (variation.canHandleItemStack(itemStack)) { // handler = variation.getVariationModelMaker(); // break; // } // } // if (handler == null) { // handler = defaultHandler; // } // // return handler; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/networking/CheckSheepChiseledRequestMessage.java // public class CheckSheepChiseledRequestMessage implements IMessage // { // private String sheepUUID = null; // // @SuppressWarnings("unused") // public CheckSheepChiseledRequestMessage() {} // // public CheckSheepChiseledRequestMessage(Entity sheep) // { // sheepUUID = sheep.getCachedUniqueIdString(); // } // // @Override // public void fromBytes(ByteBuf buf) // { // sheepUUID = ByteBufUtils.readUTF8String(buf); // // } // // @Override // public void toBytes(ByteBuf buf) // { // ByteBufUtils.writeUTF8String(buf, sheepUUID); // } // // String getSheepUUID() // { // return sheepUUID; // } // // @Override // public String toString() // { // return Objects.toStringHelper(this) // .add("sheepUUID", sheepUUID) // .toString(); // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // } // // Path: src/main/java/com/github/atomicblom/shearmadness/ShearMadnessMod.java // public static final SimpleNetworkWrapper CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel(CommonReference.MOD_ID); // Path: src/main/java/com/github/atomicblom/shearmadness/proxy/ClientForgeEventProxy.java import com.github.atomicblom.shearmadness.api.events.RegisterShearMadnessVariationEvent; import com.github.atomicblom.shearmadness.api.VariationRegistry; import com.github.atomicblom.shearmadness.networking.CheckSheepChiseledRequestMessage; import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraft.entity.Entity; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import static com.github.atomicblom.shearmadness.ShearMadnessMod.CHANNEL; package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings({"MethodMayBeStatic", "unused"}) public class ClientForgeEventProxy extends CommonForgeEventProxy { @Override public void fireRegistryEvent() {
MinecraftForge.EVENT_BUS.post(new RegisterShearMadnessVariationEvent(VariationRegistry.INSTANCE));
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/proxy/ClientForgeEventProxy.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/events/RegisterShearMadnessVariationEvent.java // @SideOnly(Side.CLIENT) // public class RegisterShearMadnessVariationEvent extends Event // { // private final IVariationRegistry registry; // // public RegisterShearMadnessVariationEvent(IVariationRegistry registry) { // // this.registry = registry; // } // // /** // * @return A registry to declare variation against. // */ // public IVariationRegistry getRegistry() // { // return registry; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/api/VariationRegistry.java // @SideOnly(Side.CLIENT) // public class VariationRegistry implements IVariationRegistry // { // public static final VariationRegistry INSTANCE = new VariationRegistry(); // // private VariationRegistry() {} // // private final List<ShearMadnessVariation> variations = new LinkedList<>(); // // private final IModelMaker defaultHandler = new DefaultModelMaker(); // // @Override // public void registerVariation(Function<ItemStack, Boolean> handlesVariant, IModelMaker variationModelMaker) { // variations.add(new ShearMadnessVariation(handlesVariant, variationModelMaker)); // } // // @Override // public void registerVariation(Function<ItemStack, Boolean> handlesVariant, QuadrupedTransformDefinition transformDefinition) // { // variations.add(new ShearMadnessVariation(handlesVariant, new DefaultModelMaker(transformDefinition))); // } // // public IModelMaker getVariationModelMaker(ItemStack itemStack) { // IModelMaker handler = null; // for (final ShearMadnessVariation variation : variations) // { // if (variation.canHandleItemStack(itemStack)) { // handler = variation.getVariationModelMaker(); // break; // } // } // if (handler == null) { // handler = defaultHandler; // } // // return handler; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/networking/CheckSheepChiseledRequestMessage.java // public class CheckSheepChiseledRequestMessage implements IMessage // { // private String sheepUUID = null; // // @SuppressWarnings("unused") // public CheckSheepChiseledRequestMessage() {} // // public CheckSheepChiseledRequestMessage(Entity sheep) // { // sheepUUID = sheep.getCachedUniqueIdString(); // } // // @Override // public void fromBytes(ByteBuf buf) // { // sheepUUID = ByteBufUtils.readUTF8String(buf); // // } // // @Override // public void toBytes(ByteBuf buf) // { // ByteBufUtils.writeUTF8String(buf, sheepUUID); // } // // String getSheepUUID() // { // return sheepUUID; // } // // @Override // public String toString() // { // return Objects.toStringHelper(this) // .add("sheepUUID", sheepUUID) // .toString(); // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // } // // Path: src/main/java/com/github/atomicblom/shearmadness/ShearMadnessMod.java // public static final SimpleNetworkWrapper CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel(CommonReference.MOD_ID);
import com.github.atomicblom.shearmadness.api.events.RegisterShearMadnessVariationEvent; import com.github.atomicblom.shearmadness.api.VariationRegistry; import com.github.atomicblom.shearmadness.networking.CheckSheepChiseledRequestMessage; import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraft.entity.Entity; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import static com.github.atomicblom.shearmadness.ShearMadnessMod.CHANNEL;
package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings({"MethodMayBeStatic", "unused"}) public class ClientForgeEventProxy extends CommonForgeEventProxy { @Override public void fireRegistryEvent() { MinecraftForge.EVENT_BUS.post(new RegisterShearMadnessVariationEvent(VariationRegistry.INSTANCE)); super.fireRegistryEvent(); } @SubscribeEvent public void onEntityJoinWorldEvent(EntityJoinWorldEvent event) { final Entity entity = event.getEntity(); if (entity instanceof EntitySheep) {
// Path: src/api/java/com/github/atomicblom/shearmadness/api/events/RegisterShearMadnessVariationEvent.java // @SideOnly(Side.CLIENT) // public class RegisterShearMadnessVariationEvent extends Event // { // private final IVariationRegistry registry; // // public RegisterShearMadnessVariationEvent(IVariationRegistry registry) { // // this.registry = registry; // } // // /** // * @return A registry to declare variation against. // */ // public IVariationRegistry getRegistry() // { // return registry; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/api/VariationRegistry.java // @SideOnly(Side.CLIENT) // public class VariationRegistry implements IVariationRegistry // { // public static final VariationRegistry INSTANCE = new VariationRegistry(); // // private VariationRegistry() {} // // private final List<ShearMadnessVariation> variations = new LinkedList<>(); // // private final IModelMaker defaultHandler = new DefaultModelMaker(); // // @Override // public void registerVariation(Function<ItemStack, Boolean> handlesVariant, IModelMaker variationModelMaker) { // variations.add(new ShearMadnessVariation(handlesVariant, variationModelMaker)); // } // // @Override // public void registerVariation(Function<ItemStack, Boolean> handlesVariant, QuadrupedTransformDefinition transformDefinition) // { // variations.add(new ShearMadnessVariation(handlesVariant, new DefaultModelMaker(transformDefinition))); // } // // public IModelMaker getVariationModelMaker(ItemStack itemStack) { // IModelMaker handler = null; // for (final ShearMadnessVariation variation : variations) // { // if (variation.canHandleItemStack(itemStack)) { // handler = variation.getVariationModelMaker(); // break; // } // } // if (handler == null) { // handler = defaultHandler; // } // // return handler; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/networking/CheckSheepChiseledRequestMessage.java // public class CheckSheepChiseledRequestMessage implements IMessage // { // private String sheepUUID = null; // // @SuppressWarnings("unused") // public CheckSheepChiseledRequestMessage() {} // // public CheckSheepChiseledRequestMessage(Entity sheep) // { // sheepUUID = sheep.getCachedUniqueIdString(); // } // // @Override // public void fromBytes(ByteBuf buf) // { // sheepUUID = ByteBufUtils.readUTF8String(buf); // // } // // @Override // public void toBytes(ByteBuf buf) // { // ByteBufUtils.writeUTF8String(buf, sheepUUID); // } // // String getSheepUUID() // { // return sheepUUID; // } // // @Override // public String toString() // { // return Objects.toStringHelper(this) // .add("sheepUUID", sheepUUID) // .toString(); // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // } // // Path: src/main/java/com/github/atomicblom/shearmadness/ShearMadnessMod.java // public static final SimpleNetworkWrapper CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel(CommonReference.MOD_ID); // Path: src/main/java/com/github/atomicblom/shearmadness/proxy/ClientForgeEventProxy.java import com.github.atomicblom.shearmadness.api.events.RegisterShearMadnessVariationEvent; import com.github.atomicblom.shearmadness.api.VariationRegistry; import com.github.atomicblom.shearmadness.networking.CheckSheepChiseledRequestMessage; import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraft.entity.Entity; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import static com.github.atomicblom.shearmadness.ShearMadnessMod.CHANNEL; package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings({"MethodMayBeStatic", "unused"}) public class ClientForgeEventProxy extends CommonForgeEventProxy { @Override public void fireRegistryEvent() { MinecraftForge.EVENT_BUS.post(new RegisterShearMadnessVariationEvent(VariationRegistry.INSTANCE)); super.fireRegistryEvent(); } @SubscribeEvent public void onEntityJoinWorldEvent(EntityJoinWorldEvent event) { final Entity entity = event.getEntity(); if (entity instanceof EntitySheep) {
CHANNEL.sendToServer(new CheckSheepChiseledRequestMessage(entity));
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/proxy/ClientForgeEventProxy.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/events/RegisterShearMadnessVariationEvent.java // @SideOnly(Side.CLIENT) // public class RegisterShearMadnessVariationEvent extends Event // { // private final IVariationRegistry registry; // // public RegisterShearMadnessVariationEvent(IVariationRegistry registry) { // // this.registry = registry; // } // // /** // * @return A registry to declare variation against. // */ // public IVariationRegistry getRegistry() // { // return registry; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/api/VariationRegistry.java // @SideOnly(Side.CLIENT) // public class VariationRegistry implements IVariationRegistry // { // public static final VariationRegistry INSTANCE = new VariationRegistry(); // // private VariationRegistry() {} // // private final List<ShearMadnessVariation> variations = new LinkedList<>(); // // private final IModelMaker defaultHandler = new DefaultModelMaker(); // // @Override // public void registerVariation(Function<ItemStack, Boolean> handlesVariant, IModelMaker variationModelMaker) { // variations.add(new ShearMadnessVariation(handlesVariant, variationModelMaker)); // } // // @Override // public void registerVariation(Function<ItemStack, Boolean> handlesVariant, QuadrupedTransformDefinition transformDefinition) // { // variations.add(new ShearMadnessVariation(handlesVariant, new DefaultModelMaker(transformDefinition))); // } // // public IModelMaker getVariationModelMaker(ItemStack itemStack) { // IModelMaker handler = null; // for (final ShearMadnessVariation variation : variations) // { // if (variation.canHandleItemStack(itemStack)) { // handler = variation.getVariationModelMaker(); // break; // } // } // if (handler == null) { // handler = defaultHandler; // } // // return handler; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/networking/CheckSheepChiseledRequestMessage.java // public class CheckSheepChiseledRequestMessage implements IMessage // { // private String sheepUUID = null; // // @SuppressWarnings("unused") // public CheckSheepChiseledRequestMessage() {} // // public CheckSheepChiseledRequestMessage(Entity sheep) // { // sheepUUID = sheep.getCachedUniqueIdString(); // } // // @Override // public void fromBytes(ByteBuf buf) // { // sheepUUID = ByteBufUtils.readUTF8String(buf); // // } // // @Override // public void toBytes(ByteBuf buf) // { // ByteBufUtils.writeUTF8String(buf, sheepUUID); // } // // String getSheepUUID() // { // return sheepUUID; // } // // @Override // public String toString() // { // return Objects.toStringHelper(this) // .add("sheepUUID", sheepUUID) // .toString(); // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // } // // Path: src/main/java/com/github/atomicblom/shearmadness/ShearMadnessMod.java // public static final SimpleNetworkWrapper CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel(CommonReference.MOD_ID);
import com.github.atomicblom.shearmadness.api.events.RegisterShearMadnessVariationEvent; import com.github.atomicblom.shearmadness.api.VariationRegistry; import com.github.atomicblom.shearmadness.networking.CheckSheepChiseledRequestMessage; import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraft.entity.Entity; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import static com.github.atomicblom.shearmadness.ShearMadnessMod.CHANNEL;
package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings({"MethodMayBeStatic", "unused"}) public class ClientForgeEventProxy extends CommonForgeEventProxy { @Override public void fireRegistryEvent() { MinecraftForge.EVENT_BUS.post(new RegisterShearMadnessVariationEvent(VariationRegistry.INSTANCE)); super.fireRegistryEvent(); } @SubscribeEvent public void onEntityJoinWorldEvent(EntityJoinWorldEvent event) { final Entity entity = event.getEntity(); if (entity instanceof EntitySheep) {
// Path: src/api/java/com/github/atomicblom/shearmadness/api/events/RegisterShearMadnessVariationEvent.java // @SideOnly(Side.CLIENT) // public class RegisterShearMadnessVariationEvent extends Event // { // private final IVariationRegistry registry; // // public RegisterShearMadnessVariationEvent(IVariationRegistry registry) { // // this.registry = registry; // } // // /** // * @return A registry to declare variation against. // */ // public IVariationRegistry getRegistry() // { // return registry; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/api/VariationRegistry.java // @SideOnly(Side.CLIENT) // public class VariationRegistry implements IVariationRegistry // { // public static final VariationRegistry INSTANCE = new VariationRegistry(); // // private VariationRegistry() {} // // private final List<ShearMadnessVariation> variations = new LinkedList<>(); // // private final IModelMaker defaultHandler = new DefaultModelMaker(); // // @Override // public void registerVariation(Function<ItemStack, Boolean> handlesVariant, IModelMaker variationModelMaker) { // variations.add(new ShearMadnessVariation(handlesVariant, variationModelMaker)); // } // // @Override // public void registerVariation(Function<ItemStack, Boolean> handlesVariant, QuadrupedTransformDefinition transformDefinition) // { // variations.add(new ShearMadnessVariation(handlesVariant, new DefaultModelMaker(transformDefinition))); // } // // public IModelMaker getVariationModelMaker(ItemStack itemStack) { // IModelMaker handler = null; // for (final ShearMadnessVariation variation : variations) // { // if (variation.canHandleItemStack(itemStack)) { // handler = variation.getVariationModelMaker(); // break; // } // } // if (handler == null) { // handler = defaultHandler; // } // // return handler; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/networking/CheckSheepChiseledRequestMessage.java // public class CheckSheepChiseledRequestMessage implements IMessage // { // private String sheepUUID = null; // // @SuppressWarnings("unused") // public CheckSheepChiseledRequestMessage() {} // // public CheckSheepChiseledRequestMessage(Entity sheep) // { // sheepUUID = sheep.getCachedUniqueIdString(); // } // // @Override // public void fromBytes(ByteBuf buf) // { // sheepUUID = ByteBufUtils.readUTF8String(buf); // // } // // @Override // public void toBytes(ByteBuf buf) // { // ByteBufUtils.writeUTF8String(buf, sheepUUID); // } // // String getSheepUUID() // { // return sheepUUID; // } // // @Override // public String toString() // { // return Objects.toStringHelper(this) // .add("sheepUUID", sheepUUID) // .toString(); // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // } // // Path: src/main/java/com/github/atomicblom/shearmadness/ShearMadnessMod.java // public static final SimpleNetworkWrapper CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel(CommonReference.MOD_ID); // Path: src/main/java/com/github/atomicblom/shearmadness/proxy/ClientForgeEventProxy.java import com.github.atomicblom.shearmadness.api.events.RegisterShearMadnessVariationEvent; import com.github.atomicblom.shearmadness.api.VariationRegistry; import com.github.atomicblom.shearmadness.networking.CheckSheepChiseledRequestMessage; import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraft.entity.Entity; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import static com.github.atomicblom.shearmadness.ShearMadnessMod.CHANNEL; package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings({"MethodMayBeStatic", "unused"}) public class ClientForgeEventProxy extends CommonForgeEventProxy { @Override public void fireRegistryEvent() { MinecraftForge.EVENT_BUS.post(new RegisterShearMadnessVariationEvent(VariationRegistry.INSTANCE)); super.fireRegistryEvent(); } @SubscribeEvent public void onEntityJoinWorldEvent(EntityJoinWorldEvent event) { final Entity entity = event.getEntity(); if (entity instanceof EntitySheep) {
CHANNEL.sendToServer(new CheckSheepChiseledRequestMessage(entity));
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/networking/SheepChiseledMessageHandler.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/SoundLibrary.java // @SuppressWarnings("ALL") // @ObjectHolder(CommonReference.MOD_ID) // public class SoundLibrary // { // public static SoundEvent sheepchiseled = null; // }
import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.utility.SoundLibrary; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.util.SoundCategory; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
package com.github.atomicblom.shearmadness.networking; public class SheepChiseledMessageHandler implements IMessageHandler<SheepChiseledMessage, IMessage> { @SuppressWarnings({"ReturnOfNull", "ConstantConditions"}) @Override public IMessage onMessage(SheepChiseledMessage message, MessageContext ctx) { final int sheepId = message.getSheepId(); final Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(sheepId); if (entity == null) { return null; }
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/SoundLibrary.java // @SuppressWarnings("ALL") // @ObjectHolder(CommonReference.MOD_ID) // public class SoundLibrary // { // public static SoundEvent sheepchiseled = null; // } // Path: src/main/java/com/github/atomicblom/shearmadness/networking/SheepChiseledMessageHandler.java import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.utility.SoundLibrary; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.util.SoundCategory; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; package com.github.atomicblom.shearmadness.networking; public class SheepChiseledMessageHandler implements IMessageHandler<SheepChiseledMessage, IMessage> { @SuppressWarnings({"ReturnOfNull", "ConstantConditions"}) @Override public IMessage onMessage(SheepChiseledMessage message, MessageContext ctx) { final int sheepId = message.getSheepId(); final Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(sheepId); if (entity == null) { return null; }
final IChiseledSheepCapability capability = entity.getCapability(Capability.CHISELED_SHEEP, null);
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/networking/SheepChiseledMessageHandler.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/SoundLibrary.java // @SuppressWarnings("ALL") // @ObjectHolder(CommonReference.MOD_ID) // public class SoundLibrary // { // public static SoundEvent sheepchiseled = null; // }
import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.utility.SoundLibrary; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.util.SoundCategory; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
package com.github.atomicblom.shearmadness.networking; public class SheepChiseledMessageHandler implements IMessageHandler<SheepChiseledMessage, IMessage> { @SuppressWarnings({"ReturnOfNull", "ConstantConditions"}) @Override public IMessage onMessage(SheepChiseledMessage message, MessageContext ctx) { final int sheepId = message.getSheepId(); final Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(sheepId); if (entity == null) { return null; }
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/SoundLibrary.java // @SuppressWarnings("ALL") // @ObjectHolder(CommonReference.MOD_ID) // public class SoundLibrary // { // public static SoundEvent sheepchiseled = null; // } // Path: src/main/java/com/github/atomicblom/shearmadness/networking/SheepChiseledMessageHandler.java import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.utility.SoundLibrary; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.util.SoundCategory; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; package com.github.atomicblom.shearmadness.networking; public class SheepChiseledMessageHandler implements IMessageHandler<SheepChiseledMessage, IMessage> { @SuppressWarnings({"ReturnOfNull", "ConstantConditions"}) @Override public IMessage onMessage(SheepChiseledMessage message, MessageContext ctx) { final int sheepId = message.getSheepId(); final Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(sheepId); if (entity == null) { return null; }
final IChiseledSheepCapability capability = entity.getCapability(Capability.CHISELED_SHEEP, null);
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/networking/SheepChiseledMessageHandler.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/SoundLibrary.java // @SuppressWarnings("ALL") // @ObjectHolder(CommonReference.MOD_ID) // public class SoundLibrary // { // public static SoundEvent sheepchiseled = null; // }
import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.utility.SoundLibrary; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.util.SoundCategory; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
package com.github.atomicblom.shearmadness.networking; public class SheepChiseledMessageHandler implements IMessageHandler<SheepChiseledMessage, IMessage> { @SuppressWarnings({"ReturnOfNull", "ConstantConditions"}) @Override public IMessage onMessage(SheepChiseledMessage message, MessageContext ctx) { final int sheepId = message.getSheepId(); final Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(sheepId); if (entity == null) { return null; } final IChiseledSheepCapability capability = entity.getCapability(Capability.CHISELED_SHEEP, null); if (capability == null) { return null; } final boolean chiseled = message.isChiseled(); if (chiseled) { capability.chisel(message.getChiselItemStack());
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/SoundLibrary.java // @SuppressWarnings("ALL") // @ObjectHolder(CommonReference.MOD_ID) // public class SoundLibrary // { // public static SoundEvent sheepchiseled = null; // } // Path: src/main/java/com/github/atomicblom/shearmadness/networking/SheepChiseledMessageHandler.java import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.utility.SoundLibrary; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.util.SoundCategory; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; package com.github.atomicblom.shearmadness.networking; public class SheepChiseledMessageHandler implements IMessageHandler<SheepChiseledMessage, IMessage> { @SuppressWarnings({"ReturnOfNull", "ConstantConditions"}) @Override public IMessage onMessage(SheepChiseledMessage message, MessageContext ctx) { final int sheepId = message.getSheepId(); final Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(sheepId); if (entity == null) { return null; } final IChiseledSheepCapability capability = entity.getCapability(Capability.CHISELED_SHEEP, null); if (capability == null) { return null; } final boolean chiseled = message.isChiseled(); if (chiseled) { capability.chisel(message.getChiselItemStack());
entity.worldObj.playSound(entity.posX, entity.posY, entity.posZ, SoundLibrary.sheepchiseled, SoundCategory.NEUTRAL, 0.5F, 1.0f, true);
AtomicBlom/ShearMadness
src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/ChanceCubeCommand.java
// Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/capability/IChanceCubeParticipationCapability.java // public interface IChanceCubeParticipationCapability { // boolean isParticipating(); // void setParticipation(boolean isParticipating); // }
import com.github.atomicblom.shearmadness.variations.chancecubes.capability.IChanceCubeParticipationCapability; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.server.MinecraftServer; import net.minecraft.util.text.TextComponentTranslation; import net.minecraftforge.common.capabilities.ICapabilityProvider;
package com.github.atomicblom.shearmadness.variations.chancecubes; public class ChanceCubeCommand extends CommandBase{ @Override public String getCommandName() { return "chancecubes"; } @Override public String getCommandUsage(ICommandSender sender) { return "command.shearmadness:chancecube.usage"; } @Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (sender instanceof ICapabilityProvider) { if (((ICapabilityProvider) sender).hasCapability(ChanceCubesReference.CHANCE_CUBE_PARTICIPATION, null)) {
// Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/capability/IChanceCubeParticipationCapability.java // public interface IChanceCubeParticipationCapability { // boolean isParticipating(); // void setParticipation(boolean isParticipating); // } // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/ChanceCubeCommand.java import com.github.atomicblom.shearmadness.variations.chancecubes.capability.IChanceCubeParticipationCapability; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.server.MinecraftServer; import net.minecraft.util.text.TextComponentTranslation; import net.minecraftforge.common.capabilities.ICapabilityProvider; package com.github.atomicblom.shearmadness.variations.chancecubes; public class ChanceCubeCommand extends CommandBase{ @Override public String getCommandName() { return "chancecubes"; } @Override public String getCommandUsage(ICommandSender sender) { return "command.shearmadness:chancecube.usage"; } @Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (sender instanceof ICapabilityProvider) { if (((ICapabilityProvider) sender).hasCapability(ChanceCubesReference.CHANCE_CUBE_PARTICIPATION, null)) {
final IChanceCubeParticipationCapability capability = ((ICapabilityProvider) sender).getCapability(ChanceCubesReference.CHANCE_CUBE_PARTICIPATION, null);
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/configuration/ConfigurationHandler.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/events/ShearMadnessSyncSettingsEvent.java // public class ShearMadnessSyncSettingsEvent extends Event { // private Configuration config; // // public ShearMadnessSyncSettingsEvent(Configuration config) { // // this.config = config; // } // // public Configuration getConfig() { // return config; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java // public enum Logger // { // INSTANCE; // // @SuppressWarnings({"NonSerializableFieldInSerializableClass", "InstanceVariableMayNotBeInitialized"}) // private org.apache.logging.log4j.Logger logger; // // public static void info(final String format, final Object... args) // { // INSTANCE.log(Level.INFO, format, args); // } // // public static void log(final Level level, final Throwable exception, final String format, final Object... args) // { // //noinspection ChainedMethodCall // INSTANCE.getLogger().log(level, String.format(format, args), exception); // } // // public static void severe(final String format, final Object... args) // { // INSTANCE.log(Level.ERROR, format, args); // } // // public static void warning(final String format, final Object... args) // { // INSTANCE.log(Level.WARN, format, args); // } // // public static void trace(final String format, final Object... args) // { // INSTANCE.log(Level.TRACE, format, args); // } // // private org.apache.logging.log4j.Logger getLogger() // { // if (logger == null) // { // init(); // } // // return logger; // } // // private void init() // { // if (logger == null) // { // logger = LogManager.getLogger(CommonReference.MOD_ID); // } // } // // private void log(final Level level, final String format, final Object... data) // { // //noinspection ChainedMethodCall // getLogger().log(level, String.format(format, data)); // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // }
import com.github.atomicblom.shearmadness.api.events.ShearMadnessSyncSettingsEvent; import com.github.atomicblom.shearmadness.utility.Logger; import com.github.atomicblom.shearmadness.variations.CommonReference; import com.google.common.base.Objects; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Optional; import static com.google.common.base.Preconditions.*;
package com.github.atomicblom.shearmadness.configuration; @SuppressWarnings({"OptionalUsedAsFieldOrParameterType", "NonSerializableFieldInSerializableClass"}) public enum ConfigurationHandler { INSTANCE; private static final String CONFIG_VERSION = "2"; private File fileRef = null; private Configuration config = null; private Optional<Configuration> configOld = Optional.empty(); public static void init(File configFile) { INSTANCE.setConfig(configFile); MinecraftForge.EVENT_BUS.register(INSTANCE); } public Configuration getConfig() { return config; } private void setConfig(File configFile) { checkState(config == null, "ConfigurationHandler has been initialized more than once."); fileRef = configFile; config = new Configuration(configFile, CONFIG_VERSION); if (!CONFIG_VERSION.equals(config.getLoadedConfigVersion())) { final File fileBak = new File(fileRef.getAbsolutePath() + '_' + new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + ".old");
// Path: src/api/java/com/github/atomicblom/shearmadness/api/events/ShearMadnessSyncSettingsEvent.java // public class ShearMadnessSyncSettingsEvent extends Event { // private Configuration config; // // public ShearMadnessSyncSettingsEvent(Configuration config) { // // this.config = config; // } // // public Configuration getConfig() { // return config; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java // public enum Logger // { // INSTANCE; // // @SuppressWarnings({"NonSerializableFieldInSerializableClass", "InstanceVariableMayNotBeInitialized"}) // private org.apache.logging.log4j.Logger logger; // // public static void info(final String format, final Object... args) // { // INSTANCE.log(Level.INFO, format, args); // } // // public static void log(final Level level, final Throwable exception, final String format, final Object... args) // { // //noinspection ChainedMethodCall // INSTANCE.getLogger().log(level, String.format(format, args), exception); // } // // public static void severe(final String format, final Object... args) // { // INSTANCE.log(Level.ERROR, format, args); // } // // public static void warning(final String format, final Object... args) // { // INSTANCE.log(Level.WARN, format, args); // } // // public static void trace(final String format, final Object... args) // { // INSTANCE.log(Level.TRACE, format, args); // } // // private org.apache.logging.log4j.Logger getLogger() // { // if (logger == null) // { // init(); // } // // return logger; // } // // private void init() // { // if (logger == null) // { // logger = LogManager.getLogger(CommonReference.MOD_ID); // } // } // // private void log(final Level level, final String format, final Object... data) // { // //noinspection ChainedMethodCall // getLogger().log(level, String.format(format, data)); // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // } // Path: src/main/java/com/github/atomicblom/shearmadness/configuration/ConfigurationHandler.java import com.github.atomicblom.shearmadness.api.events.ShearMadnessSyncSettingsEvent; import com.github.atomicblom.shearmadness.utility.Logger; import com.github.atomicblom.shearmadness.variations.CommonReference; import com.google.common.base.Objects; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Optional; import static com.google.common.base.Preconditions.*; package com.github.atomicblom.shearmadness.configuration; @SuppressWarnings({"OptionalUsedAsFieldOrParameterType", "NonSerializableFieldInSerializableClass"}) public enum ConfigurationHandler { INSTANCE; private static final String CONFIG_VERSION = "2"; private File fileRef = null; private Configuration config = null; private Optional<Configuration> configOld = Optional.empty(); public static void init(File configFile) { INSTANCE.setConfig(configFile); MinecraftForge.EVENT_BUS.register(INSTANCE); } public Configuration getConfig() { return config; } private void setConfig(File configFile) { checkState(config == null, "ConfigurationHandler has been initialized more than once."); fileRef = configFile; config = new Configuration(configFile, CONFIG_VERSION); if (!CONFIG_VERSION.equals(config.getLoadedConfigVersion())) { final File fileBak = new File(fileRef.getAbsolutePath() + '_' + new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + ".old");
Logger.warning("Your %s config file is out of date and could cause issues. The existing file will be renamed to %s and a new one will be generated.",
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/configuration/ConfigurationHandler.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/events/ShearMadnessSyncSettingsEvent.java // public class ShearMadnessSyncSettingsEvent extends Event { // private Configuration config; // // public ShearMadnessSyncSettingsEvent(Configuration config) { // // this.config = config; // } // // public Configuration getConfig() { // return config; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java // public enum Logger // { // INSTANCE; // // @SuppressWarnings({"NonSerializableFieldInSerializableClass", "InstanceVariableMayNotBeInitialized"}) // private org.apache.logging.log4j.Logger logger; // // public static void info(final String format, final Object... args) // { // INSTANCE.log(Level.INFO, format, args); // } // // public static void log(final Level level, final Throwable exception, final String format, final Object... args) // { // //noinspection ChainedMethodCall // INSTANCE.getLogger().log(level, String.format(format, args), exception); // } // // public static void severe(final String format, final Object... args) // { // INSTANCE.log(Level.ERROR, format, args); // } // // public static void warning(final String format, final Object... args) // { // INSTANCE.log(Level.WARN, format, args); // } // // public static void trace(final String format, final Object... args) // { // INSTANCE.log(Level.TRACE, format, args); // } // // private org.apache.logging.log4j.Logger getLogger() // { // if (logger == null) // { // init(); // } // // return logger; // } // // private void init() // { // if (logger == null) // { // logger = LogManager.getLogger(CommonReference.MOD_ID); // } // } // // private void log(final Level level, final String format, final Object... data) // { // //noinspection ChainedMethodCall // getLogger().log(level, String.format(format, data)); // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // }
import com.github.atomicblom.shearmadness.api.events.ShearMadnessSyncSettingsEvent; import com.github.atomicblom.shearmadness.utility.Logger; import com.github.atomicblom.shearmadness.variations.CommonReference; import com.google.common.base.Objects; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Optional; import static com.google.common.base.Preconditions.*;
package com.github.atomicblom.shearmadness.configuration; @SuppressWarnings({"OptionalUsedAsFieldOrParameterType", "NonSerializableFieldInSerializableClass"}) public enum ConfigurationHandler { INSTANCE; private static final String CONFIG_VERSION = "2"; private File fileRef = null; private Configuration config = null; private Optional<Configuration> configOld = Optional.empty(); public static void init(File configFile) { INSTANCE.setConfig(configFile); MinecraftForge.EVENT_BUS.register(INSTANCE); } public Configuration getConfig() { return config; } private void setConfig(File configFile) { checkState(config == null, "ConfigurationHandler has been initialized more than once."); fileRef = configFile; config = new Configuration(configFile, CONFIG_VERSION); if (!CONFIG_VERSION.equals(config.getLoadedConfigVersion())) { final File fileBak = new File(fileRef.getAbsolutePath() + '_' + new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + ".old"); Logger.warning("Your %s config file is out of date and could cause issues. The existing file will be renamed to %s and a new one will be generated.",
// Path: src/api/java/com/github/atomicblom/shearmadness/api/events/ShearMadnessSyncSettingsEvent.java // public class ShearMadnessSyncSettingsEvent extends Event { // private Configuration config; // // public ShearMadnessSyncSettingsEvent(Configuration config) { // // this.config = config; // } // // public Configuration getConfig() { // return config; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java // public enum Logger // { // INSTANCE; // // @SuppressWarnings({"NonSerializableFieldInSerializableClass", "InstanceVariableMayNotBeInitialized"}) // private org.apache.logging.log4j.Logger logger; // // public static void info(final String format, final Object... args) // { // INSTANCE.log(Level.INFO, format, args); // } // // public static void log(final Level level, final Throwable exception, final String format, final Object... args) // { // //noinspection ChainedMethodCall // INSTANCE.getLogger().log(level, String.format(format, args), exception); // } // // public static void severe(final String format, final Object... args) // { // INSTANCE.log(Level.ERROR, format, args); // } // // public static void warning(final String format, final Object... args) // { // INSTANCE.log(Level.WARN, format, args); // } // // public static void trace(final String format, final Object... args) // { // INSTANCE.log(Level.TRACE, format, args); // } // // private org.apache.logging.log4j.Logger getLogger() // { // if (logger == null) // { // init(); // } // // return logger; // } // // private void init() // { // if (logger == null) // { // logger = LogManager.getLogger(CommonReference.MOD_ID); // } // } // // private void log(final Level level, final String format, final Object... data) // { // //noinspection ChainedMethodCall // getLogger().log(level, String.format(format, data)); // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // } // Path: src/main/java/com/github/atomicblom/shearmadness/configuration/ConfigurationHandler.java import com.github.atomicblom.shearmadness.api.events.ShearMadnessSyncSettingsEvent; import com.github.atomicblom.shearmadness.utility.Logger; import com.github.atomicblom.shearmadness.variations.CommonReference; import com.google.common.base.Objects; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Optional; import static com.google.common.base.Preconditions.*; package com.github.atomicblom.shearmadness.configuration; @SuppressWarnings({"OptionalUsedAsFieldOrParameterType", "NonSerializableFieldInSerializableClass"}) public enum ConfigurationHandler { INSTANCE; private static final String CONFIG_VERSION = "2"; private File fileRef = null; private Configuration config = null; private Optional<Configuration> configOld = Optional.empty(); public static void init(File configFile) { INSTANCE.setConfig(configFile); MinecraftForge.EVENT_BUS.register(INSTANCE); } public Configuration getConfig() { return config; } private void setConfig(File configFile) { checkState(config == null, "ConfigurationHandler has been initialized more than once."); fileRef = configFile; config = new Configuration(configFile, CONFIG_VERSION); if (!CONFIG_VERSION.equals(config.getLoadedConfigVersion())) { final File fileBak = new File(fileRef.getAbsolutePath() + '_' + new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + ".old"); Logger.warning("Your %s config file is out of date and could cause issues. The existing file will be renamed to %s and a new one will be generated.",
CommonReference.MOD_NAME, fileBak.getName());
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/configuration/ConfigurationHandler.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/events/ShearMadnessSyncSettingsEvent.java // public class ShearMadnessSyncSettingsEvent extends Event { // private Configuration config; // // public ShearMadnessSyncSettingsEvent(Configuration config) { // // this.config = config; // } // // public Configuration getConfig() { // return config; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java // public enum Logger // { // INSTANCE; // // @SuppressWarnings({"NonSerializableFieldInSerializableClass", "InstanceVariableMayNotBeInitialized"}) // private org.apache.logging.log4j.Logger logger; // // public static void info(final String format, final Object... args) // { // INSTANCE.log(Level.INFO, format, args); // } // // public static void log(final Level level, final Throwable exception, final String format, final Object... args) // { // //noinspection ChainedMethodCall // INSTANCE.getLogger().log(level, String.format(format, args), exception); // } // // public static void severe(final String format, final Object... args) // { // INSTANCE.log(Level.ERROR, format, args); // } // // public static void warning(final String format, final Object... args) // { // INSTANCE.log(Level.WARN, format, args); // } // // public static void trace(final String format, final Object... args) // { // INSTANCE.log(Level.TRACE, format, args); // } // // private org.apache.logging.log4j.Logger getLogger() // { // if (logger == null) // { // init(); // } // // return logger; // } // // private void init() // { // if (logger == null) // { // logger = LogManager.getLogger(CommonReference.MOD_ID); // } // } // // private void log(final Level level, final String format, final Object... data) // { // //noinspection ChainedMethodCall // getLogger().log(level, String.format(format, data)); // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // }
import com.github.atomicblom.shearmadness.api.events.ShearMadnessSyncSettingsEvent; import com.github.atomicblom.shearmadness.utility.Logger; import com.github.atomicblom.shearmadness.variations.CommonReference; import com.google.common.base.Objects; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Optional; import static com.google.common.base.Preconditions.*;
syncConfig(true); } void syncConfig() { syncConfig(false); } @SuppressWarnings("OverlyBroadCatchBlock") private void syncConfig(boolean skipLoad) { if (!skipLoad) { try { config.load(); } catch (final Exception e) { final File fileBak = new File(fileRef.getAbsolutePath() + '_' + new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + ".errored"); Logger.severe("An exception occurred while loading your config file. This file will be renamed to %s and a new config file will be generated.", fileBak.getName()); Logger.severe("Exception encountered: %s", e.getLocalizedMessage()); final boolean success = fileRef.renameTo(fileBak); Logger.warning("Rename %s successful.", success ? "was" : "was not"); config = new Configuration(fileRef, CONFIG_VERSION); } convertOldConfig(); }
// Path: src/api/java/com/github/atomicblom/shearmadness/api/events/ShearMadnessSyncSettingsEvent.java // public class ShearMadnessSyncSettingsEvent extends Event { // private Configuration config; // // public ShearMadnessSyncSettingsEvent(Configuration config) { // // this.config = config; // } // // public Configuration getConfig() { // return config; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java // public enum Logger // { // INSTANCE; // // @SuppressWarnings({"NonSerializableFieldInSerializableClass", "InstanceVariableMayNotBeInitialized"}) // private org.apache.logging.log4j.Logger logger; // // public static void info(final String format, final Object... args) // { // INSTANCE.log(Level.INFO, format, args); // } // // public static void log(final Level level, final Throwable exception, final String format, final Object... args) // { // //noinspection ChainedMethodCall // INSTANCE.getLogger().log(level, String.format(format, args), exception); // } // // public static void severe(final String format, final Object... args) // { // INSTANCE.log(Level.ERROR, format, args); // } // // public static void warning(final String format, final Object... args) // { // INSTANCE.log(Level.WARN, format, args); // } // // public static void trace(final String format, final Object... args) // { // INSTANCE.log(Level.TRACE, format, args); // } // // private org.apache.logging.log4j.Logger getLogger() // { // if (logger == null) // { // init(); // } // // return logger; // } // // private void init() // { // if (logger == null) // { // logger = LogManager.getLogger(CommonReference.MOD_ID); // } // } // // private void log(final Level level, final String format, final Object... data) // { // //noinspection ChainedMethodCall // getLogger().log(level, String.format(format, data)); // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // } // Path: src/main/java/com/github/atomicblom/shearmadness/configuration/ConfigurationHandler.java import com.github.atomicblom.shearmadness.api.events.ShearMadnessSyncSettingsEvent; import com.github.atomicblom.shearmadness.utility.Logger; import com.github.atomicblom.shearmadness.variations.CommonReference; import com.google.common.base.Objects; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Optional; import static com.google.common.base.Preconditions.*; syncConfig(true); } void syncConfig() { syncConfig(false); } @SuppressWarnings("OverlyBroadCatchBlock") private void syncConfig(boolean skipLoad) { if (!skipLoad) { try { config.load(); } catch (final Exception e) { final File fileBak = new File(fileRef.getAbsolutePath() + '_' + new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + ".errored"); Logger.severe("An exception occurred while loading your config file. This file will be renamed to %s and a new config file will be generated.", fileBak.getName()); Logger.severe("Exception encountered: %s", e.getLocalizedMessage()); final boolean success = fileRef.renameTo(fileBak); Logger.warning("Rename %s successful.", success ? "was" : "was not"); config = new Configuration(fileRef, CONFIG_VERSION); } convertOldConfig(); }
MinecraftForge.EVENT_BUS.post(new ShearMadnessSyncSettingsEvent(config));
AtomicBlom/ShearMadness
src/integration/java/com/github/atomicblom/shearmadness/variations/vanilla/interactions/WorkbenchInteraction.java
// Path: src/integration/java/com/github/atomicblom/shearmadness/variations/vanilla/container/ContainerWorkbenchSheep.java // public class ContainerWorkbenchSheep extends ContainerWorkbench // { // private final EntityLiving entity; // private final World world; // private final IChiseledSheepCapability capability; // // public ContainerWorkbenchSheep(InventoryPlayer playerInventory, World worldIn, EntityLiving entity) // { // super(playerInventory, worldIn, entity.getPosition()); // this.entity = entity; // this.world = worldIn; // capability = entity.getCapability(Capability.CHISELED_SHEEP, null); // onContainerOpened(); // } // // @Override // public boolean canInteractWith(EntityPlayer playerIn) { // if (capability == null) { // return false; // } // // if (!ItemStackHelper.isStackForBlock(capability.getChiselItemStack(), Blocks.CRAFTING_TABLE)) { // return false; // } // // return playerIn.getDistanceSq(entity.getPosition()) <= 64.0D; // } // // private void onContainerOpened() { // if (!world.isRemote) { // final NBTTagCompound extraData = capability.getExtraData(); // final NBTTagCompound craftMatrixNBT = extraData.getCompoundTag("AUTO_CRAFT"); // // for (int i = 0; i < 9; ++i) // { // final String key = ((Integer) i).toString(); // // if (craftMatrixNBT.hasKey(key)) { // final ItemStack itemstack = ItemStack.loadItemStackFromNBT(craftMatrixNBT.getCompoundTag(key)); // craftMatrix.setInventorySlotContents(i, itemstack); // } // } // // detectAndSendChanges(); // onCraftMatrixChanged(craftMatrix); // } // } // // /** // * Called when the container is closed. // */ // @Override // public void onContainerClosed(EntityPlayer playerIn) // { // if (!world.isRemote) // { // final NBTTagCompound extraData = capability.getExtraData(); // final NBTTagCompound craftMatrixNBT = new NBTTagCompound(); // // for (int i = 0; i < 9; ++i) // { // final ItemStack itemstack = craftMatrix.removeStackFromSlot(i); // // if (itemstack != null) // { // craftMatrixNBT.setTag(((Integer)i).toString(), itemstack.serializeNBT()); // } // } // // extraData.setTag("AUTO_CRAFT", craftMatrixNBT); // craftMatrixNBT.setLong("lastChanged", this.entity.getEntityWorld().getTotalWorldTime()); // } // // super.onContainerClosed(playerIn); // } // }
import com.github.atomicblom.shearmadness.variations.vanilla.container.ContainerWorkbenchSheep; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.inventory.Container; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.IInteractionObject; import net.minecraft.world.World;
package com.github.atomicblom.shearmadness.variations.vanilla.interactions; public class WorkbenchInteraction implements IInteractionObject { private final World world; private final EntityLiving entity; public WorkbenchInteraction(World world, EntityLiving entity) { this.world = world; this.entity = entity; } /** * Get the name of this object. For players this returns their username */ @Override public String getName() { return null; } /** * Returns true if this thing is named */ @Override public boolean hasCustomName() { return false; } /** * Get the formatted ChatComponent that will be used for the sender's username in chat */ @Override public ITextComponent getDisplayName() { return new TextComponentTranslation(Blocks.CRAFTING_TABLE.getUnlocalizedName() + ".name"); } @Override public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) {
// Path: src/integration/java/com/github/atomicblom/shearmadness/variations/vanilla/container/ContainerWorkbenchSheep.java // public class ContainerWorkbenchSheep extends ContainerWorkbench // { // private final EntityLiving entity; // private final World world; // private final IChiseledSheepCapability capability; // // public ContainerWorkbenchSheep(InventoryPlayer playerInventory, World worldIn, EntityLiving entity) // { // super(playerInventory, worldIn, entity.getPosition()); // this.entity = entity; // this.world = worldIn; // capability = entity.getCapability(Capability.CHISELED_SHEEP, null); // onContainerOpened(); // } // // @Override // public boolean canInteractWith(EntityPlayer playerIn) { // if (capability == null) { // return false; // } // // if (!ItemStackHelper.isStackForBlock(capability.getChiselItemStack(), Blocks.CRAFTING_TABLE)) { // return false; // } // // return playerIn.getDistanceSq(entity.getPosition()) <= 64.0D; // } // // private void onContainerOpened() { // if (!world.isRemote) { // final NBTTagCompound extraData = capability.getExtraData(); // final NBTTagCompound craftMatrixNBT = extraData.getCompoundTag("AUTO_CRAFT"); // // for (int i = 0; i < 9; ++i) // { // final String key = ((Integer) i).toString(); // // if (craftMatrixNBT.hasKey(key)) { // final ItemStack itemstack = ItemStack.loadItemStackFromNBT(craftMatrixNBT.getCompoundTag(key)); // craftMatrix.setInventorySlotContents(i, itemstack); // } // } // // detectAndSendChanges(); // onCraftMatrixChanged(craftMatrix); // } // } // // /** // * Called when the container is closed. // */ // @Override // public void onContainerClosed(EntityPlayer playerIn) // { // if (!world.isRemote) // { // final NBTTagCompound extraData = capability.getExtraData(); // final NBTTagCompound craftMatrixNBT = new NBTTagCompound(); // // for (int i = 0; i < 9; ++i) // { // final ItemStack itemstack = craftMatrix.removeStackFromSlot(i); // // if (itemstack != null) // { // craftMatrixNBT.setTag(((Integer)i).toString(), itemstack.serializeNBT()); // } // } // // extraData.setTag("AUTO_CRAFT", craftMatrixNBT); // craftMatrixNBT.setLong("lastChanged", this.entity.getEntityWorld().getTotalWorldTime()); // } // // super.onContainerClosed(playerIn); // } // } // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/vanilla/interactions/WorkbenchInteraction.java import com.github.atomicblom.shearmadness.variations.vanilla.container.ContainerWorkbenchSheep; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.inventory.Container; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.IInteractionObject; import net.minecraft.world.World; package com.github.atomicblom.shearmadness.variations.vanilla.interactions; public class WorkbenchInteraction implements IInteractionObject { private final World world; private final EntityLiving entity; public WorkbenchInteraction(World world, EntityLiving entity) { this.world = world; this.entity = entity; } /** * Get the name of this object. For players this returns their username */ @Override public String getName() { return null; } /** * Returns true if this thing is named */ @Override public boolean hasCustomName() { return false; } /** * Get the formatted ChatComponent that will be used for the sender's username in chat */ @Override public ITextComponent getDisplayName() { return new TextComponentTranslation(Blocks.CRAFTING_TABLE.getUnlocalizedName() + ".name"); } @Override public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) {
return new ContainerWorkbenchSheep(playerInventory, world, entity);
AtomicBlom/ShearMadness
src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/DelayedTask.java
// Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java // public enum Logger // { // INSTANCE; // // @SuppressWarnings({"NonSerializableFieldInSerializableClass", "InstanceVariableMayNotBeInitialized"}) // private org.apache.logging.log4j.Logger logger; // // public static void info(final String format, final Object... args) // { // INSTANCE.log(Level.INFO, format, args); // } // // public static void log(final Level level, final Throwable exception, final String format, final Object... args) // { // //noinspection ChainedMethodCall // INSTANCE.getLogger().log(level, String.format(format, args), exception); // } // // public static void severe(final String format, final Object... args) // { // INSTANCE.log(Level.ERROR, format, args); // } // // public static void warning(final String format, final Object... args) // { // INSTANCE.log(Level.WARN, format, args); // } // // public static void trace(final String format, final Object... args) // { // INSTANCE.log(Level.TRACE, format, args); // } // // private org.apache.logging.log4j.Logger getLogger() // { // if (logger == null) // { // init(); // } // // return logger; // } // // private void init() // { // if (logger == null) // { // logger = LogManager.getLogger(CommonReference.MOD_ID); // } // } // // private void log(final Level level, final String format, final Object... data) // { // //noinspection ChainedMethodCall // getLogger().log(level, String.format(format, data)); // } // }
import com.github.atomicblom.shearmadness.utility.Logger; import java.util.concurrent.Callable;
package com.github.atomicblom.shearmadness.variations.chancecubes; public class DelayedTask implements Comparable<DelayedTask> { private final long expectedTick; private final Action task; public DelayedTask(long expectedTick, Action task) { this.expectedTick = expectedTick; this.task = task; } public void executeJob() { try { task.execute(); } catch (Exception e) {
// Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java // public enum Logger // { // INSTANCE; // // @SuppressWarnings({"NonSerializableFieldInSerializableClass", "InstanceVariableMayNotBeInitialized"}) // private org.apache.logging.log4j.Logger logger; // // public static void info(final String format, final Object... args) // { // INSTANCE.log(Level.INFO, format, args); // } // // public static void log(final Level level, final Throwable exception, final String format, final Object... args) // { // //noinspection ChainedMethodCall // INSTANCE.getLogger().log(level, String.format(format, args), exception); // } // // public static void severe(final String format, final Object... args) // { // INSTANCE.log(Level.ERROR, format, args); // } // // public static void warning(final String format, final Object... args) // { // INSTANCE.log(Level.WARN, format, args); // } // // public static void trace(final String format, final Object... args) // { // INSTANCE.log(Level.TRACE, format, args); // } // // private org.apache.logging.log4j.Logger getLogger() // { // if (logger == null) // { // init(); // } // // return logger; // } // // private void init() // { // if (logger == null) // { // logger = LogManager.getLogger(CommonReference.MOD_ID); // } // } // // private void log(final Level level, final String format, final Object... data) // { // //noinspection ChainedMethodCall // getLogger().log(level, String.format(format, data)); // } // } // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/DelayedTask.java import com.github.atomicblom.shearmadness.utility.Logger; import java.util.concurrent.Callable; package com.github.atomicblom.shearmadness.variations.chancecubes; public class DelayedTask implements Comparable<DelayedTask> { private final long expectedTick; private final Action task; public DelayedTask(long expectedTick, Action task) { this.expectedTick = expectedTick; this.task = task; } public void executeJob() { try { task.execute(); } catch (Exception e) {
Logger.warning("Failed to execute Delayed Task", e);
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/networking/CheckSheepChiseledRequestMessageHandler.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java // public enum Logger // { // INSTANCE; // // @SuppressWarnings({"NonSerializableFieldInSerializableClass", "InstanceVariableMayNotBeInitialized"}) // private org.apache.logging.log4j.Logger logger; // // public static void info(final String format, final Object... args) // { // INSTANCE.log(Level.INFO, format, args); // } // // public static void log(final Level level, final Throwable exception, final String format, final Object... args) // { // //noinspection ChainedMethodCall // INSTANCE.getLogger().log(level, String.format(format, args), exception); // } // // public static void severe(final String format, final Object... args) // { // INSTANCE.log(Level.ERROR, format, args); // } // // public static void warning(final String format, final Object... args) // { // INSTANCE.log(Level.WARN, format, args); // } // // public static void trace(final String format, final Object... args) // { // INSTANCE.log(Level.TRACE, format, args); // } // // private org.apache.logging.log4j.Logger getLogger() // { // if (logger == null) // { // init(); // } // // return logger; // } // // private void init() // { // if (logger == null) // { // logger = LogManager.getLogger(CommonReference.MOD_ID); // } // } // // private void log(final Level level, final String format, final Object... data) // { // //noinspection ChainedMethodCall // getLogger().log(level, String.format(format, data)); // } // }
import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.utility.Logger; import net.minecraft.entity.Entity; import net.minecraft.world.WorldServer; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import java.util.UUID;
package com.github.atomicblom.shearmadness.networking; public class CheckSheepChiseledRequestMessageHandler implements IMessageHandler<CheckSheepChiseledRequestMessage, SheepChiseledMessage> { @SuppressWarnings({"ReturnOfNull", "ConstantConditions"}) @Override public SheepChiseledMessage onMessage(CheckSheepChiseledRequestMessage message, MessageContext ctx) { final WorldServer worldObj = (WorldServer) ctx.getServerHandler().playerEntity.worldObj; final Entity entity = worldObj.getEntityFromUuid(UUID.fromString(message.getSheepUUID())); if (entity == null) { return null; }
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java // public enum Logger // { // INSTANCE; // // @SuppressWarnings({"NonSerializableFieldInSerializableClass", "InstanceVariableMayNotBeInitialized"}) // private org.apache.logging.log4j.Logger logger; // // public static void info(final String format, final Object... args) // { // INSTANCE.log(Level.INFO, format, args); // } // // public static void log(final Level level, final Throwable exception, final String format, final Object... args) // { // //noinspection ChainedMethodCall // INSTANCE.getLogger().log(level, String.format(format, args), exception); // } // // public static void severe(final String format, final Object... args) // { // INSTANCE.log(Level.ERROR, format, args); // } // // public static void warning(final String format, final Object... args) // { // INSTANCE.log(Level.WARN, format, args); // } // // public static void trace(final String format, final Object... args) // { // INSTANCE.log(Level.TRACE, format, args); // } // // private org.apache.logging.log4j.Logger getLogger() // { // if (logger == null) // { // init(); // } // // return logger; // } // // private void init() // { // if (logger == null) // { // logger = LogManager.getLogger(CommonReference.MOD_ID); // } // } // // private void log(final Level level, final String format, final Object... data) // { // //noinspection ChainedMethodCall // getLogger().log(level, String.format(format, data)); // } // } // Path: src/main/java/com/github/atomicblom/shearmadness/networking/CheckSheepChiseledRequestMessageHandler.java import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.utility.Logger; import net.minecraft.entity.Entity; import net.minecraft.world.WorldServer; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import java.util.UUID; package com.github.atomicblom.shearmadness.networking; public class CheckSheepChiseledRequestMessageHandler implements IMessageHandler<CheckSheepChiseledRequestMessage, SheepChiseledMessage> { @SuppressWarnings({"ReturnOfNull", "ConstantConditions"}) @Override public SheepChiseledMessage onMessage(CheckSheepChiseledRequestMessage message, MessageContext ctx) { final WorldServer worldObj = (WorldServer) ctx.getServerHandler().playerEntity.worldObj; final Entity entity = worldObj.getEntityFromUuid(UUID.fromString(message.getSheepUUID())); if (entity == null) { return null; }
final IChiseledSheepCapability capability = entity.getCapability(Capability.CHISELED_SHEEP, null);
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/networking/CheckSheepChiseledRequestMessageHandler.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java // public enum Logger // { // INSTANCE; // // @SuppressWarnings({"NonSerializableFieldInSerializableClass", "InstanceVariableMayNotBeInitialized"}) // private org.apache.logging.log4j.Logger logger; // // public static void info(final String format, final Object... args) // { // INSTANCE.log(Level.INFO, format, args); // } // // public static void log(final Level level, final Throwable exception, final String format, final Object... args) // { // //noinspection ChainedMethodCall // INSTANCE.getLogger().log(level, String.format(format, args), exception); // } // // public static void severe(final String format, final Object... args) // { // INSTANCE.log(Level.ERROR, format, args); // } // // public static void warning(final String format, final Object... args) // { // INSTANCE.log(Level.WARN, format, args); // } // // public static void trace(final String format, final Object... args) // { // INSTANCE.log(Level.TRACE, format, args); // } // // private org.apache.logging.log4j.Logger getLogger() // { // if (logger == null) // { // init(); // } // // return logger; // } // // private void init() // { // if (logger == null) // { // logger = LogManager.getLogger(CommonReference.MOD_ID); // } // } // // private void log(final Level level, final String format, final Object... data) // { // //noinspection ChainedMethodCall // getLogger().log(level, String.format(format, data)); // } // }
import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.utility.Logger; import net.minecraft.entity.Entity; import net.minecraft.world.WorldServer; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import java.util.UUID;
package com.github.atomicblom.shearmadness.networking; public class CheckSheepChiseledRequestMessageHandler implements IMessageHandler<CheckSheepChiseledRequestMessage, SheepChiseledMessage> { @SuppressWarnings({"ReturnOfNull", "ConstantConditions"}) @Override public SheepChiseledMessage onMessage(CheckSheepChiseledRequestMessage message, MessageContext ctx) { final WorldServer worldObj = (WorldServer) ctx.getServerHandler().playerEntity.worldObj; final Entity entity = worldObj.getEntityFromUuid(UUID.fromString(message.getSheepUUID())); if (entity == null) { return null; }
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java // public enum Logger // { // INSTANCE; // // @SuppressWarnings({"NonSerializableFieldInSerializableClass", "InstanceVariableMayNotBeInitialized"}) // private org.apache.logging.log4j.Logger logger; // // public static void info(final String format, final Object... args) // { // INSTANCE.log(Level.INFO, format, args); // } // // public static void log(final Level level, final Throwable exception, final String format, final Object... args) // { // //noinspection ChainedMethodCall // INSTANCE.getLogger().log(level, String.format(format, args), exception); // } // // public static void severe(final String format, final Object... args) // { // INSTANCE.log(Level.ERROR, format, args); // } // // public static void warning(final String format, final Object... args) // { // INSTANCE.log(Level.WARN, format, args); // } // // public static void trace(final String format, final Object... args) // { // INSTANCE.log(Level.TRACE, format, args); // } // // private org.apache.logging.log4j.Logger getLogger() // { // if (logger == null) // { // init(); // } // // return logger; // } // // private void init() // { // if (logger == null) // { // logger = LogManager.getLogger(CommonReference.MOD_ID); // } // } // // private void log(final Level level, final String format, final Object... data) // { // //noinspection ChainedMethodCall // getLogger().log(level, String.format(format, data)); // } // } // Path: src/main/java/com/github/atomicblom/shearmadness/networking/CheckSheepChiseledRequestMessageHandler.java import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.utility.Logger; import net.minecraft.entity.Entity; import net.minecraft.world.WorldServer; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import java.util.UUID; package com.github.atomicblom.shearmadness.networking; public class CheckSheepChiseledRequestMessageHandler implements IMessageHandler<CheckSheepChiseledRequestMessage, SheepChiseledMessage> { @SuppressWarnings({"ReturnOfNull", "ConstantConditions"}) @Override public SheepChiseledMessage onMessage(CheckSheepChiseledRequestMessage message, MessageContext ctx) { final WorldServer worldObj = (WorldServer) ctx.getServerHandler().playerEntity.worldObj; final Entity entity = worldObj.getEntityFromUuid(UUID.fromString(message.getSheepUUID())); if (entity == null) { return null; }
final IChiseledSheepCapability capability = entity.getCapability(Capability.CHISELED_SHEEP, null);
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/networking/CheckSheepChiseledRequestMessageHandler.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java // public enum Logger // { // INSTANCE; // // @SuppressWarnings({"NonSerializableFieldInSerializableClass", "InstanceVariableMayNotBeInitialized"}) // private org.apache.logging.log4j.Logger logger; // // public static void info(final String format, final Object... args) // { // INSTANCE.log(Level.INFO, format, args); // } // // public static void log(final Level level, final Throwable exception, final String format, final Object... args) // { // //noinspection ChainedMethodCall // INSTANCE.getLogger().log(level, String.format(format, args), exception); // } // // public static void severe(final String format, final Object... args) // { // INSTANCE.log(Level.ERROR, format, args); // } // // public static void warning(final String format, final Object... args) // { // INSTANCE.log(Level.WARN, format, args); // } // // public static void trace(final String format, final Object... args) // { // INSTANCE.log(Level.TRACE, format, args); // } // // private org.apache.logging.log4j.Logger getLogger() // { // if (logger == null) // { // init(); // } // // return logger; // } // // private void init() // { // if (logger == null) // { // logger = LogManager.getLogger(CommonReference.MOD_ID); // } // } // // private void log(final Level level, final String format, final Object... data) // { // //noinspection ChainedMethodCall // getLogger().log(level, String.format(format, data)); // } // }
import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.utility.Logger; import net.minecraft.entity.Entity; import net.minecraft.world.WorldServer; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import java.util.UUID;
package com.github.atomicblom.shearmadness.networking; public class CheckSheepChiseledRequestMessageHandler implements IMessageHandler<CheckSheepChiseledRequestMessage, SheepChiseledMessage> { @SuppressWarnings({"ReturnOfNull", "ConstantConditions"}) @Override public SheepChiseledMessage onMessage(CheckSheepChiseledRequestMessage message, MessageContext ctx) { final WorldServer worldObj = (WorldServer) ctx.getServerHandler().playerEntity.worldObj; final Entity entity = worldObj.getEntityFromUuid(UUID.fromString(message.getSheepUUID())); if (entity == null) { return null; } final IChiseledSheepCapability capability = entity.getCapability(Capability.CHISELED_SHEEP, null); if (capability == null) { return null; } if (capability.isChiseled()) {
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Logger.java // public enum Logger // { // INSTANCE; // // @SuppressWarnings({"NonSerializableFieldInSerializableClass", "InstanceVariableMayNotBeInitialized"}) // private org.apache.logging.log4j.Logger logger; // // public static void info(final String format, final Object... args) // { // INSTANCE.log(Level.INFO, format, args); // } // // public static void log(final Level level, final Throwable exception, final String format, final Object... args) // { // //noinspection ChainedMethodCall // INSTANCE.getLogger().log(level, String.format(format, args), exception); // } // // public static void severe(final String format, final Object... args) // { // INSTANCE.log(Level.ERROR, format, args); // } // // public static void warning(final String format, final Object... args) // { // INSTANCE.log(Level.WARN, format, args); // } // // public static void trace(final String format, final Object... args) // { // INSTANCE.log(Level.TRACE, format, args); // } // // private org.apache.logging.log4j.Logger getLogger() // { // if (logger == null) // { // init(); // } // // return logger; // } // // private void init() // { // if (logger == null) // { // logger = LogManager.getLogger(CommonReference.MOD_ID); // } // } // // private void log(final Level level, final String format, final Object... data) // { // //noinspection ChainedMethodCall // getLogger().log(level, String.format(format, data)); // } // } // Path: src/main/java/com/github/atomicblom/shearmadness/networking/CheckSheepChiseledRequestMessageHandler.java import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.utility.Logger; import net.minecraft.entity.Entity; import net.minecraft.world.WorldServer; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import java.util.UUID; package com.github.atomicblom.shearmadness.networking; public class CheckSheepChiseledRequestMessageHandler implements IMessageHandler<CheckSheepChiseledRequestMessage, SheepChiseledMessage> { @SuppressWarnings({"ReturnOfNull", "ConstantConditions"}) @Override public SheepChiseledMessage onMessage(CheckSheepChiseledRequestMessage message, MessageContext ctx) { final WorldServer worldObj = (WorldServer) ctx.getServerHandler().playerEntity.worldObj; final Entity entity = worldObj.getEntityFromUuid(UUID.fromString(message.getSheepUUID())); if (entity == null) { return null; } final IChiseledSheepCapability capability = entity.getCapability(Capability.CHISELED_SHEEP, null); if (capability == null) { return null; } if (capability.isChiseled()) {
Logger.info("Notifying sheep chiseled - entity %s", entity.toString());
AtomicBlom/ShearMadness
src/integration/java/com/github/atomicblom/shearmadness/variations/chisel/ChiselVariations.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/IVariationRegistry.java // @SideOnly(Side.CLIENT) // public interface IVariationRegistry // { // /** // * Registers a Model Maker that will be used when the function predicate matches // * @param handlesVariant a function that should return true if your IModelMaker applies to the itemStack // * @param variationModelMaker the model maker that will make the model for the quadruped. // */ // void registerVariation(Function<ItemStack, Boolean> handlesVariant, IModelMaker variationModelMaker); // // /** // * Registers a Model Maker that will be used when the function predicate matches using the default model maker // * with custom transformations. // * @param handlesVariant a function that should return true if your IModelMaker applies to the itemStack // * @param transformDefinition the transforms for the model // */ // void registerVariation(Function<ItemStack, Boolean> handlesVariant, QuadrupedTransformDefinition transformDefinition); // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/events/RegisterShearMadnessVariationEvent.java // @SideOnly(Side.CLIENT) // public class RegisterShearMadnessVariationEvent extends Event // { // private final IVariationRegistry registry; // // public RegisterShearMadnessVariationEvent(IVariationRegistry registry) { // // this.registry = registry; // } // // /** // * @return A registry to declare variation against. // */ // public IVariationRegistry getRegistry() // { // return registry; // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chisel/visuals/DefaultChiselModelMaker.java // public class DefaultChiselModelMaker implements IModelMaker // { // private final QuadrupedTransformDefinition transforms; // // public DefaultChiselModelMaker() { // transforms = new QuadrupedTransformDefinition(); // } // // @Override // public ModelQuadruped createModel(ItemStack itemStack, EntityLivingBase entity) // { // transforms.defineParts(); // final ICarvingVariation variation = CarvingUtils.getChiselRegistry().getVariation(itemStack); // // final BlockPos position = entity.getPosition(); // final World world = entity.getEntityWorld(); // // final ModelQuadruped quadrupedModel = new ModelSheep1(); // transforms.getBodyPartDefinition().ifPresent(definition -> quadrupedModel.body = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getHeadPartDefinition().ifPresent(definition -> quadrupedModel.head = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg1PartDefinition().ifPresent(definition -> quadrupedModel.leg1 = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg2PartDefinition().ifPresent(definition -> quadrupedModel.leg2 = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg3PartDefinition().ifPresent(definition -> quadrupedModel.leg3 = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg4PartDefinition().ifPresent(definition -> quadrupedModel.leg4 = getChiselBodyModelRenderer(variation, definition, world, position)); // return quadrupedModel; // } // // private ModelRenderer getChiselBodyModelRenderer(ICarvingVariation variation, PartDefinition partDefinition, World world, BlockPos position) // { // final IBlockState blockState = variation.getBlockState(); // final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); // ChiselExtendedState chiselState = new ChiselExtendedState(blockState, world, position); // final IBakedModel model = blockRenderer.getModelForState(blockState); // // // return getModelRendererForBlockState(partDefinition, chiselState, model); // } // }
import com.github.atomicblom.shearmadness.api.IVariationRegistry; import com.github.atomicblom.shearmadness.api.events.RegisterShearMadnessVariationEvent; import com.github.atomicblom.shearmadness.variations.chisel.visuals.DefaultChiselModelMaker; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import team.chisel.api.carving.CarvingUtils;
package com.github.atomicblom.shearmadness.variations.chisel; @SuppressWarnings({"MethodMayBeStatic", "AnonymousInnerClass"}) @Mod.EventBusSubscriber(Side.CLIENT) public class ChiselVariations { @SubscribeEvent(priority = EventPriority.LOWEST) @Optional.Method(modid = "shearmadness") @SideOnly(Side.CLIENT)
// Path: src/api/java/com/github/atomicblom/shearmadness/api/IVariationRegistry.java // @SideOnly(Side.CLIENT) // public interface IVariationRegistry // { // /** // * Registers a Model Maker that will be used when the function predicate matches // * @param handlesVariant a function that should return true if your IModelMaker applies to the itemStack // * @param variationModelMaker the model maker that will make the model for the quadruped. // */ // void registerVariation(Function<ItemStack, Boolean> handlesVariant, IModelMaker variationModelMaker); // // /** // * Registers a Model Maker that will be used when the function predicate matches using the default model maker // * with custom transformations. // * @param handlesVariant a function that should return true if your IModelMaker applies to the itemStack // * @param transformDefinition the transforms for the model // */ // void registerVariation(Function<ItemStack, Boolean> handlesVariant, QuadrupedTransformDefinition transformDefinition); // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/events/RegisterShearMadnessVariationEvent.java // @SideOnly(Side.CLIENT) // public class RegisterShearMadnessVariationEvent extends Event // { // private final IVariationRegistry registry; // // public RegisterShearMadnessVariationEvent(IVariationRegistry registry) { // // this.registry = registry; // } // // /** // * @return A registry to declare variation against. // */ // public IVariationRegistry getRegistry() // { // return registry; // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chisel/visuals/DefaultChiselModelMaker.java // public class DefaultChiselModelMaker implements IModelMaker // { // private final QuadrupedTransformDefinition transforms; // // public DefaultChiselModelMaker() { // transforms = new QuadrupedTransformDefinition(); // } // // @Override // public ModelQuadruped createModel(ItemStack itemStack, EntityLivingBase entity) // { // transforms.defineParts(); // final ICarvingVariation variation = CarvingUtils.getChiselRegistry().getVariation(itemStack); // // final BlockPos position = entity.getPosition(); // final World world = entity.getEntityWorld(); // // final ModelQuadruped quadrupedModel = new ModelSheep1(); // transforms.getBodyPartDefinition().ifPresent(definition -> quadrupedModel.body = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getHeadPartDefinition().ifPresent(definition -> quadrupedModel.head = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg1PartDefinition().ifPresent(definition -> quadrupedModel.leg1 = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg2PartDefinition().ifPresent(definition -> quadrupedModel.leg2 = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg3PartDefinition().ifPresent(definition -> quadrupedModel.leg3 = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg4PartDefinition().ifPresent(definition -> quadrupedModel.leg4 = getChiselBodyModelRenderer(variation, definition, world, position)); // return quadrupedModel; // } // // private ModelRenderer getChiselBodyModelRenderer(ICarvingVariation variation, PartDefinition partDefinition, World world, BlockPos position) // { // final IBlockState blockState = variation.getBlockState(); // final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); // ChiselExtendedState chiselState = new ChiselExtendedState(blockState, world, position); // final IBakedModel model = blockRenderer.getModelForState(blockState); // // // return getModelRendererForBlockState(partDefinition, chiselState, model); // } // } // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chisel/ChiselVariations.java import com.github.atomicblom.shearmadness.api.IVariationRegistry; import com.github.atomicblom.shearmadness.api.events.RegisterShearMadnessVariationEvent; import com.github.atomicblom.shearmadness.variations.chisel.visuals.DefaultChiselModelMaker; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import team.chisel.api.carving.CarvingUtils; package com.github.atomicblom.shearmadness.variations.chisel; @SuppressWarnings({"MethodMayBeStatic", "AnonymousInnerClass"}) @Mod.EventBusSubscriber(Side.CLIENT) public class ChiselVariations { @SubscribeEvent(priority = EventPriority.LOWEST) @Optional.Method(modid = "shearmadness") @SideOnly(Side.CLIENT)
public static void onShearMadnessRegisterVariations(RegisterShearMadnessVariationEvent event) {
AtomicBlom/ShearMadness
src/integration/java/com/github/atomicblom/shearmadness/variations/chisel/ChiselVariations.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/IVariationRegistry.java // @SideOnly(Side.CLIENT) // public interface IVariationRegistry // { // /** // * Registers a Model Maker that will be used when the function predicate matches // * @param handlesVariant a function that should return true if your IModelMaker applies to the itemStack // * @param variationModelMaker the model maker that will make the model for the quadruped. // */ // void registerVariation(Function<ItemStack, Boolean> handlesVariant, IModelMaker variationModelMaker); // // /** // * Registers a Model Maker that will be used when the function predicate matches using the default model maker // * with custom transformations. // * @param handlesVariant a function that should return true if your IModelMaker applies to the itemStack // * @param transformDefinition the transforms for the model // */ // void registerVariation(Function<ItemStack, Boolean> handlesVariant, QuadrupedTransformDefinition transformDefinition); // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/events/RegisterShearMadnessVariationEvent.java // @SideOnly(Side.CLIENT) // public class RegisterShearMadnessVariationEvent extends Event // { // private final IVariationRegistry registry; // // public RegisterShearMadnessVariationEvent(IVariationRegistry registry) { // // this.registry = registry; // } // // /** // * @return A registry to declare variation against. // */ // public IVariationRegistry getRegistry() // { // return registry; // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chisel/visuals/DefaultChiselModelMaker.java // public class DefaultChiselModelMaker implements IModelMaker // { // private final QuadrupedTransformDefinition transforms; // // public DefaultChiselModelMaker() { // transforms = new QuadrupedTransformDefinition(); // } // // @Override // public ModelQuadruped createModel(ItemStack itemStack, EntityLivingBase entity) // { // transforms.defineParts(); // final ICarvingVariation variation = CarvingUtils.getChiselRegistry().getVariation(itemStack); // // final BlockPos position = entity.getPosition(); // final World world = entity.getEntityWorld(); // // final ModelQuadruped quadrupedModel = new ModelSheep1(); // transforms.getBodyPartDefinition().ifPresent(definition -> quadrupedModel.body = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getHeadPartDefinition().ifPresent(definition -> quadrupedModel.head = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg1PartDefinition().ifPresent(definition -> quadrupedModel.leg1 = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg2PartDefinition().ifPresent(definition -> quadrupedModel.leg2 = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg3PartDefinition().ifPresent(definition -> quadrupedModel.leg3 = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg4PartDefinition().ifPresent(definition -> quadrupedModel.leg4 = getChiselBodyModelRenderer(variation, definition, world, position)); // return quadrupedModel; // } // // private ModelRenderer getChiselBodyModelRenderer(ICarvingVariation variation, PartDefinition partDefinition, World world, BlockPos position) // { // final IBlockState blockState = variation.getBlockState(); // final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); // ChiselExtendedState chiselState = new ChiselExtendedState(blockState, world, position); // final IBakedModel model = blockRenderer.getModelForState(blockState); // // // return getModelRendererForBlockState(partDefinition, chiselState, model); // } // }
import com.github.atomicblom.shearmadness.api.IVariationRegistry; import com.github.atomicblom.shearmadness.api.events.RegisterShearMadnessVariationEvent; import com.github.atomicblom.shearmadness.variations.chisel.visuals.DefaultChiselModelMaker; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import team.chisel.api.carving.CarvingUtils;
package com.github.atomicblom.shearmadness.variations.chisel; @SuppressWarnings({"MethodMayBeStatic", "AnonymousInnerClass"}) @Mod.EventBusSubscriber(Side.CLIENT) public class ChiselVariations { @SubscribeEvent(priority = EventPriority.LOWEST) @Optional.Method(modid = "shearmadness") @SideOnly(Side.CLIENT) public static void onShearMadnessRegisterVariations(RegisterShearMadnessVariationEvent event) {
// Path: src/api/java/com/github/atomicblom/shearmadness/api/IVariationRegistry.java // @SideOnly(Side.CLIENT) // public interface IVariationRegistry // { // /** // * Registers a Model Maker that will be used when the function predicate matches // * @param handlesVariant a function that should return true if your IModelMaker applies to the itemStack // * @param variationModelMaker the model maker that will make the model for the quadruped. // */ // void registerVariation(Function<ItemStack, Boolean> handlesVariant, IModelMaker variationModelMaker); // // /** // * Registers a Model Maker that will be used when the function predicate matches using the default model maker // * with custom transformations. // * @param handlesVariant a function that should return true if your IModelMaker applies to the itemStack // * @param transformDefinition the transforms for the model // */ // void registerVariation(Function<ItemStack, Boolean> handlesVariant, QuadrupedTransformDefinition transformDefinition); // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/events/RegisterShearMadnessVariationEvent.java // @SideOnly(Side.CLIENT) // public class RegisterShearMadnessVariationEvent extends Event // { // private final IVariationRegistry registry; // // public RegisterShearMadnessVariationEvent(IVariationRegistry registry) { // // this.registry = registry; // } // // /** // * @return A registry to declare variation against. // */ // public IVariationRegistry getRegistry() // { // return registry; // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chisel/visuals/DefaultChiselModelMaker.java // public class DefaultChiselModelMaker implements IModelMaker // { // private final QuadrupedTransformDefinition transforms; // // public DefaultChiselModelMaker() { // transforms = new QuadrupedTransformDefinition(); // } // // @Override // public ModelQuadruped createModel(ItemStack itemStack, EntityLivingBase entity) // { // transforms.defineParts(); // final ICarvingVariation variation = CarvingUtils.getChiselRegistry().getVariation(itemStack); // // final BlockPos position = entity.getPosition(); // final World world = entity.getEntityWorld(); // // final ModelQuadruped quadrupedModel = new ModelSheep1(); // transforms.getBodyPartDefinition().ifPresent(definition -> quadrupedModel.body = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getHeadPartDefinition().ifPresent(definition -> quadrupedModel.head = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg1PartDefinition().ifPresent(definition -> quadrupedModel.leg1 = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg2PartDefinition().ifPresent(definition -> quadrupedModel.leg2 = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg3PartDefinition().ifPresent(definition -> quadrupedModel.leg3 = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg4PartDefinition().ifPresent(definition -> quadrupedModel.leg4 = getChiselBodyModelRenderer(variation, definition, world, position)); // return quadrupedModel; // } // // private ModelRenderer getChiselBodyModelRenderer(ICarvingVariation variation, PartDefinition partDefinition, World world, BlockPos position) // { // final IBlockState blockState = variation.getBlockState(); // final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); // ChiselExtendedState chiselState = new ChiselExtendedState(blockState, world, position); // final IBakedModel model = blockRenderer.getModelForState(blockState); // // // return getModelRendererForBlockState(partDefinition, chiselState, model); // } // } // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chisel/ChiselVariations.java import com.github.atomicblom.shearmadness.api.IVariationRegistry; import com.github.atomicblom.shearmadness.api.events.RegisterShearMadnessVariationEvent; import com.github.atomicblom.shearmadness.variations.chisel.visuals.DefaultChiselModelMaker; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import team.chisel.api.carving.CarvingUtils; package com.github.atomicblom.shearmadness.variations.chisel; @SuppressWarnings({"MethodMayBeStatic", "AnonymousInnerClass"}) @Mod.EventBusSubscriber(Side.CLIENT) public class ChiselVariations { @SubscribeEvent(priority = EventPriority.LOWEST) @Optional.Method(modid = "shearmadness") @SideOnly(Side.CLIENT) public static void onShearMadnessRegisterVariations(RegisterShearMadnessVariationEvent event) {
final IVariationRegistry registry = event.getRegistry();
AtomicBlom/ShearMadness
src/integration/java/com/github/atomicblom/shearmadness/variations/chisel/ChiselVariations.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/IVariationRegistry.java // @SideOnly(Side.CLIENT) // public interface IVariationRegistry // { // /** // * Registers a Model Maker that will be used when the function predicate matches // * @param handlesVariant a function that should return true if your IModelMaker applies to the itemStack // * @param variationModelMaker the model maker that will make the model for the quadruped. // */ // void registerVariation(Function<ItemStack, Boolean> handlesVariant, IModelMaker variationModelMaker); // // /** // * Registers a Model Maker that will be used when the function predicate matches using the default model maker // * with custom transformations. // * @param handlesVariant a function that should return true if your IModelMaker applies to the itemStack // * @param transformDefinition the transforms for the model // */ // void registerVariation(Function<ItemStack, Boolean> handlesVariant, QuadrupedTransformDefinition transformDefinition); // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/events/RegisterShearMadnessVariationEvent.java // @SideOnly(Side.CLIENT) // public class RegisterShearMadnessVariationEvent extends Event // { // private final IVariationRegistry registry; // // public RegisterShearMadnessVariationEvent(IVariationRegistry registry) { // // this.registry = registry; // } // // /** // * @return A registry to declare variation against. // */ // public IVariationRegistry getRegistry() // { // return registry; // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chisel/visuals/DefaultChiselModelMaker.java // public class DefaultChiselModelMaker implements IModelMaker // { // private final QuadrupedTransformDefinition transforms; // // public DefaultChiselModelMaker() { // transforms = new QuadrupedTransformDefinition(); // } // // @Override // public ModelQuadruped createModel(ItemStack itemStack, EntityLivingBase entity) // { // transforms.defineParts(); // final ICarvingVariation variation = CarvingUtils.getChiselRegistry().getVariation(itemStack); // // final BlockPos position = entity.getPosition(); // final World world = entity.getEntityWorld(); // // final ModelQuadruped quadrupedModel = new ModelSheep1(); // transforms.getBodyPartDefinition().ifPresent(definition -> quadrupedModel.body = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getHeadPartDefinition().ifPresent(definition -> quadrupedModel.head = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg1PartDefinition().ifPresent(definition -> quadrupedModel.leg1 = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg2PartDefinition().ifPresent(definition -> quadrupedModel.leg2 = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg3PartDefinition().ifPresent(definition -> quadrupedModel.leg3 = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg4PartDefinition().ifPresent(definition -> quadrupedModel.leg4 = getChiselBodyModelRenderer(variation, definition, world, position)); // return quadrupedModel; // } // // private ModelRenderer getChiselBodyModelRenderer(ICarvingVariation variation, PartDefinition partDefinition, World world, BlockPos position) // { // final IBlockState blockState = variation.getBlockState(); // final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); // ChiselExtendedState chiselState = new ChiselExtendedState(blockState, world, position); // final IBakedModel model = blockRenderer.getModelForState(blockState); // // // return getModelRendererForBlockState(partDefinition, chiselState, model); // } // }
import com.github.atomicblom.shearmadness.api.IVariationRegistry; import com.github.atomicblom.shearmadness.api.events.RegisterShearMadnessVariationEvent; import com.github.atomicblom.shearmadness.variations.chisel.visuals.DefaultChiselModelMaker; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import team.chisel.api.carving.CarvingUtils;
package com.github.atomicblom.shearmadness.variations.chisel; @SuppressWarnings({"MethodMayBeStatic", "AnonymousInnerClass"}) @Mod.EventBusSubscriber(Side.CLIENT) public class ChiselVariations { @SubscribeEvent(priority = EventPriority.LOWEST) @Optional.Method(modid = "shearmadness") @SideOnly(Side.CLIENT) public static void onShearMadnessRegisterVariations(RegisterShearMadnessVariationEvent event) { final IVariationRegistry registry = event.getRegistry(); //Java 8 Style Registration registry.registerVariation( itemStack -> CarvingUtils.getChiselRegistry().getVariation(itemStack) != null,
// Path: src/api/java/com/github/atomicblom/shearmadness/api/IVariationRegistry.java // @SideOnly(Side.CLIENT) // public interface IVariationRegistry // { // /** // * Registers a Model Maker that will be used when the function predicate matches // * @param handlesVariant a function that should return true if your IModelMaker applies to the itemStack // * @param variationModelMaker the model maker that will make the model for the quadruped. // */ // void registerVariation(Function<ItemStack, Boolean> handlesVariant, IModelMaker variationModelMaker); // // /** // * Registers a Model Maker that will be used when the function predicate matches using the default model maker // * with custom transformations. // * @param handlesVariant a function that should return true if your IModelMaker applies to the itemStack // * @param transformDefinition the transforms for the model // */ // void registerVariation(Function<ItemStack, Boolean> handlesVariant, QuadrupedTransformDefinition transformDefinition); // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/events/RegisterShearMadnessVariationEvent.java // @SideOnly(Side.CLIENT) // public class RegisterShearMadnessVariationEvent extends Event // { // private final IVariationRegistry registry; // // public RegisterShearMadnessVariationEvent(IVariationRegistry registry) { // // this.registry = registry; // } // // /** // * @return A registry to declare variation against. // */ // public IVariationRegistry getRegistry() // { // return registry; // } // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chisel/visuals/DefaultChiselModelMaker.java // public class DefaultChiselModelMaker implements IModelMaker // { // private final QuadrupedTransformDefinition transforms; // // public DefaultChiselModelMaker() { // transforms = new QuadrupedTransformDefinition(); // } // // @Override // public ModelQuadruped createModel(ItemStack itemStack, EntityLivingBase entity) // { // transforms.defineParts(); // final ICarvingVariation variation = CarvingUtils.getChiselRegistry().getVariation(itemStack); // // final BlockPos position = entity.getPosition(); // final World world = entity.getEntityWorld(); // // final ModelQuadruped quadrupedModel = new ModelSheep1(); // transforms.getBodyPartDefinition().ifPresent(definition -> quadrupedModel.body = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getHeadPartDefinition().ifPresent(definition -> quadrupedModel.head = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg1PartDefinition().ifPresent(definition -> quadrupedModel.leg1 = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg2PartDefinition().ifPresent(definition -> quadrupedModel.leg2 = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg3PartDefinition().ifPresent(definition -> quadrupedModel.leg3 = getChiselBodyModelRenderer(variation, definition, world, position)); // transforms.getLeg4PartDefinition().ifPresent(definition -> quadrupedModel.leg4 = getChiselBodyModelRenderer(variation, definition, world, position)); // return quadrupedModel; // } // // private ModelRenderer getChiselBodyModelRenderer(ICarvingVariation variation, PartDefinition partDefinition, World world, BlockPos position) // { // final IBlockState blockState = variation.getBlockState(); // final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); // ChiselExtendedState chiselState = new ChiselExtendedState(blockState, world, position); // final IBakedModel model = blockRenderer.getModelForState(blockState); // // // return getModelRendererForBlockState(partDefinition, chiselState, model); // } // } // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chisel/ChiselVariations.java import com.github.atomicblom.shearmadness.api.IVariationRegistry; import com.github.atomicblom.shearmadness.api.events.RegisterShearMadnessVariationEvent; import com.github.atomicblom.shearmadness.variations.chisel.visuals.DefaultChiselModelMaker; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import team.chisel.api.carving.CarvingUtils; package com.github.atomicblom.shearmadness.variations.chisel; @SuppressWarnings({"MethodMayBeStatic", "AnonymousInnerClass"}) @Mod.EventBusSubscriber(Side.CLIENT) public class ChiselVariations { @SubscribeEvent(priority = EventPriority.LOWEST) @Optional.Method(modid = "shearmadness") @SideOnly(Side.CLIENT) public static void onShearMadnessRegisterVariations(RegisterShearMadnessVariationEvent event) { final IVariationRegistry registry = event.getRegistry(); //Java 8 Style Registration registry.registerVariation( itemStack -> CarvingUtils.getChiselRegistry().getVariation(itemStack) != null,
new DefaultChiselModelMaker()
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/proxy/CommonAudioProxy.java
// Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java // public final class Reference // { // public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; // public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; // public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + // "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + // "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + // "* CannotShear - You cannot shear the sheep while chiseled.\n"; // public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; // public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; // public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + // "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; // public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; // public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; // public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; // public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; // public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; // public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; // // private Reference() {} // // public static final class Blocks { // public static final String NORMAL_VARIANT = "normal"; // // public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone"); // public static final ResourceLocation InvisibleGlowstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleGlowstone"); // public static final ResourceLocation InvisibleBookshelf = new ResourceLocation(CommonReference.MOD_ID, "invisibleBookshelf"); // // private Blocks() {} // } // // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/SoundLibrary.java // @SuppressWarnings("ALL") // @ObjectHolder(CommonReference.MOD_ID) // public class SoundLibrary // { // public static SoundEvent sheepchiseled = null; // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // }
import com.github.atomicblom.shearmadness.utility.Reference; import com.github.atomicblom.shearmadness.utility.SoundLibrary; import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraftforge.fml.common.registry.GameRegistry;
package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings("MethodMayBeStatic") public class CommonAudioProxy { public void registerSounds() { //FIXME: Remove this once SoundEvent is added to ObjectHolderRef
// Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java // public final class Reference // { // public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; // public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; // public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + // "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + // "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + // "* CannotShear - You cannot shear the sheep while chiseled.\n"; // public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; // public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; // public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + // "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; // public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; // public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; // public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; // public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; // public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; // public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; // // private Reference() {} // // public static final class Blocks { // public static final String NORMAL_VARIANT = "normal"; // // public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone"); // public static final ResourceLocation InvisibleGlowstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleGlowstone"); // public static final ResourceLocation InvisibleBookshelf = new ResourceLocation(CommonReference.MOD_ID, "invisibleBookshelf"); // // private Blocks() {} // } // // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/SoundLibrary.java // @SuppressWarnings("ALL") // @ObjectHolder(CommonReference.MOD_ID) // public class SoundLibrary // { // public static SoundEvent sheepchiseled = null; // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // } // Path: src/main/java/com/github/atomicblom/shearmadness/proxy/CommonAudioProxy.java import com.github.atomicblom.shearmadness.utility.Reference; import com.github.atomicblom.shearmadness.utility.SoundLibrary; import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraftforge.fml.common.registry.GameRegistry; package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings("MethodMayBeStatic") public class CommonAudioProxy { public void registerSounds() { //FIXME: Remove this once SoundEvent is added to ObjectHolderRef
SoundLibrary.sheepchiseled = registerSound("sheepchiseled");
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/proxy/CommonAudioProxy.java
// Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java // public final class Reference // { // public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; // public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; // public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + // "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + // "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + // "* CannotShear - You cannot shear the sheep while chiseled.\n"; // public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; // public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; // public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + // "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; // public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; // public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; // public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; // public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; // public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; // public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; // // private Reference() {} // // public static final class Blocks { // public static final String NORMAL_VARIANT = "normal"; // // public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone"); // public static final ResourceLocation InvisibleGlowstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleGlowstone"); // public static final ResourceLocation InvisibleBookshelf = new ResourceLocation(CommonReference.MOD_ID, "invisibleBookshelf"); // // private Blocks() {} // } // // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/SoundLibrary.java // @SuppressWarnings("ALL") // @ObjectHolder(CommonReference.MOD_ID) // public class SoundLibrary // { // public static SoundEvent sheepchiseled = null; // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // }
import com.github.atomicblom.shearmadness.utility.Reference; import com.github.atomicblom.shearmadness.utility.SoundLibrary; import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraftforge.fml.common.registry.GameRegistry;
package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings("MethodMayBeStatic") public class CommonAudioProxy { public void registerSounds() { //FIXME: Remove this once SoundEvent is added to ObjectHolderRef SoundLibrary.sheepchiseled = registerSound("sheepchiseled"); } private static SoundEvent registerSound(String soundName) {
// Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java // public final class Reference // { // public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; // public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; // public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + // "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + // "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + // "* CannotShear - You cannot shear the sheep while chiseled.\n"; // public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; // public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; // public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + // "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; // public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; // public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; // public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; // public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; // public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; // public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; // // private Reference() {} // // public static final class Blocks { // public static final String NORMAL_VARIANT = "normal"; // // public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone"); // public static final ResourceLocation InvisibleGlowstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleGlowstone"); // public static final ResourceLocation InvisibleBookshelf = new ResourceLocation(CommonReference.MOD_ID, "invisibleBookshelf"); // // private Blocks() {} // } // // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/SoundLibrary.java // @SuppressWarnings("ALL") // @ObjectHolder(CommonReference.MOD_ID) // public class SoundLibrary // { // public static SoundEvent sheepchiseled = null; // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // } // Path: src/main/java/com/github/atomicblom/shearmadness/proxy/CommonAudioProxy.java import com.github.atomicblom.shearmadness.utility.Reference; import com.github.atomicblom.shearmadness.utility.SoundLibrary; import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraftforge.fml.common.registry.GameRegistry; package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings("MethodMayBeStatic") public class CommonAudioProxy { public void registerSounds() { //FIXME: Remove this once SoundEvent is added to ObjectHolderRef SoundLibrary.sheepchiseled = registerSound("sheepchiseled"); } private static SoundEvent registerSound(String soundName) {
final ResourceLocation soundID = new ResourceLocation(CommonReference.MOD_ID, soundName);
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/proxy/Proxies.java
// Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java // public final class Reference // { // public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; // public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; // public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + // "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + // "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + // "* CannotShear - You cannot shear the sheep while chiseled.\n"; // public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; // public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; // public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + // "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; // public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; // public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; // public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; // public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; // public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; // public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; // // private Reference() {} // // public static final class Blocks { // public static final String NORMAL_VARIANT = "normal"; // // public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone"); // public static final ResourceLocation InvisibleGlowstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleGlowstone"); // public static final ResourceLocation InvisibleBookshelf = new ResourceLocation(CommonReference.MOD_ID, "invisibleBookshelf"); // // private Blocks() {} // } // // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // }
import com.github.atomicblom.shearmadness.utility.Reference; import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraftforge.fml.common.SidedProxy;
package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings({"StaticNonFinalField", "UtilityClass"}) public final class Proxies { @SidedProxy(
// Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java // public final class Reference // { // public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; // public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; // public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + // "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + // "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + // "* CannotShear - You cannot shear the sheep while chiseled.\n"; // public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; // public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; // public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + // "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; // public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; // public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; // public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; // public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; // public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; // public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; // // private Reference() {} // // public static final class Blocks { // public static final String NORMAL_VARIANT = "normal"; // // public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone"); // public static final ResourceLocation InvisibleGlowstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleGlowstone"); // public static final ResourceLocation InvisibleBookshelf = new ResourceLocation(CommonReference.MOD_ID, "invisibleBookshelf"); // // private Blocks() {} // } // // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // } // Path: src/main/java/com/github/atomicblom/shearmadness/proxy/Proxies.java import com.github.atomicblom.shearmadness.utility.Reference; import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraftforge.fml.common.SidedProxy; package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings({"StaticNonFinalField", "UtilityClass"}) public final class Proxies { @SidedProxy(
modId = CommonReference.MOD_ID,
AtomicBlom/ShearMadness
src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/ParticleLibrary.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/ICustomParticleFactory.java // public interface ICustomParticleFactory extends IForgeRegistryEntry<ICustomParticleFactory> { // @SideOnly(Side.CLIENT) // IParticleFactory getParticleFactory(); // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // }
import com.github.atomicblom.shearmadness.api.particles.ICustomParticleFactory; import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraftforge.fml.common.registry.GameRegistry;
package com.github.atomicblom.shearmadness.variations.chancecubes; @GameRegistry.ObjectHolder(CommonReference.MOD_ID) public class ParticleLibrary {
// Path: src/api/java/com/github/atomicblom/shearmadness/api/particles/ICustomParticleFactory.java // public interface ICustomParticleFactory extends IForgeRegistryEntry<ICustomParticleFactory> { // @SideOnly(Side.CLIENT) // IParticleFactory getParticleFactory(); // } // // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // } // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/chancecubes/ParticleLibrary.java import com.github.atomicblom.shearmadness.api.particles.ICustomParticleFactory; import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraftforge.fml.common.registry.GameRegistry; package com.github.atomicblom.shearmadness.variations.chancecubes; @GameRegistry.ObjectHolder(CommonReference.MOD_ID) public class ParticleLibrary {
public static final ICustomParticleFactory sheep_head;
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/capability/ChiseledSheepCapability.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/ItemStackUtils.java // @SuppressWarnings("UtilityClass") // public final class ItemStackUtils // { // private ItemStackUtils() {} // // public static void dropItem(Entity nearEntity, ItemStack itemStack) // { // final EntityItem item = nearEntity.entityDropItem(itemStack, 1.0F); // final Random rand = new Random(); // item.motionY += rand.nextFloat() * 0.05F; // item.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F; // item.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F; // } // // private static final PooledByteBufAllocator allocator = new PooledByteBufAllocator(false); // // public static int getHash(ItemStack itemStack) // { // final ByteBuf buffer = allocator.heapBuffer(); // final PacketBuffer packetBuffer = new PacketBuffer(buffer); // packetBuffer.writeItemStackToBuffer(itemStack); // final int i = Arrays.hashCode(packetBuffer.array()); // packetBuffer.release(); // return i; // } // }
import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.utility.ItemStackUtils; import com.google.common.base.Objects; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import javax.annotation.Nonnull; import javax.annotation.Nullable;
package com.github.atomicblom.shearmadness.capability; public class ChiseledSheepCapability implements IChiseledSheepCapability, IWriteExtraData { @Nullable private ItemStack itemStack = null; private int itemIdentifier; private NBTTagCompound customData = null; @Override public boolean isChiseled() { return itemStack != null; } @Override public void chisel(@Nonnull ItemStack itemStack) { this.itemStack = itemStack;
// Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/ItemStackUtils.java // @SuppressWarnings("UtilityClass") // public final class ItemStackUtils // { // private ItemStackUtils() {} // // public static void dropItem(Entity nearEntity, ItemStack itemStack) // { // final EntityItem item = nearEntity.entityDropItem(itemStack, 1.0F); // final Random rand = new Random(); // item.motionY += rand.nextFloat() * 0.05F; // item.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F; // item.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F; // } // // private static final PooledByteBufAllocator allocator = new PooledByteBufAllocator(false); // // public static int getHash(ItemStack itemStack) // { // final ByteBuf buffer = allocator.heapBuffer(); // final PacketBuffer packetBuffer = new PacketBuffer(buffer); // packetBuffer.writeItemStackToBuffer(itemStack); // final int i = Arrays.hashCode(packetBuffer.array()); // packetBuffer.release(); // return i; // } // } // Path: src/main/java/com/github/atomicblom/shearmadness/capability/ChiseledSheepCapability.java import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import com.github.atomicblom.shearmadness.utility.ItemStackUtils; import com.google.common.base.Objects; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import javax.annotation.Nonnull; import javax.annotation.Nullable; package com.github.atomicblom.shearmadness.capability; public class ChiseledSheepCapability implements IChiseledSheepCapability, IWriteExtraData { @Nullable private ItemStack itemStack = null; private int itemIdentifier; private NBTTagCompound customData = null; @Override public boolean isChiseled() { return itemStack != null; } @Override public void chisel(@Nonnull ItemStack itemStack) { this.itemStack = itemStack;
itemIdentifier = ItemStackUtils.getHash(itemStack);
AtomicBlom/ShearMadness
src/integration/java/com/github/atomicblom/shearmadness/variations/vanilla/behaviour/NoteBlockBehaviour.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/behaviour/BehaviourBase.java // @SuppressWarnings({"NoopMethodInAbstractClass", "ClassHasNoToStringMethod", "WeakerAccess"}) // public abstract class BehaviourBase<T extends BehaviourBase> { // private final EntitySheep entity; // private final Supplier<Boolean> configuration; // // protected BehaviourBase(EntitySheep sheep) { // this(sheep, () -> true); // } // // protected BehaviourBase(EntitySheep entity, Supplier<Boolean> configuration) // { // this.entity = entity; // this.configuration = configuration; // } // // public boolean isBehaviourEnabled() { // return configuration.get(); // } // // public void onSheepMovedBlock(BlockPos previousLocation, BlockPos newLocation) {} // // public void onBehaviourStarted(BlockPos currentPos) {} // // public void onBehaviourStopped(BlockPos previousPos) {} // // public void updateTask() {} // // public boolean isEquivalentTo(T other) { // return entity.getUniqueID().equals(other.getEntity().getUniqueID()); // } // // public EntitySheep getEntity() // { // return entity; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // }
import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.behaviour.BehaviourBase; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import net.minecraft.block.BlockNote; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.world.NoteBlockEvent; import java.util.function.Supplier;
package com.github.atomicblom.shearmadness.variations.vanilla.behaviour; public class NoteBlockBehaviour extends BehaviourBase<NoteBlockBehaviour> { private final World world;
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/behaviour/BehaviourBase.java // @SuppressWarnings({"NoopMethodInAbstractClass", "ClassHasNoToStringMethod", "WeakerAccess"}) // public abstract class BehaviourBase<T extends BehaviourBase> { // private final EntitySheep entity; // private final Supplier<Boolean> configuration; // // protected BehaviourBase(EntitySheep sheep) { // this(sheep, () -> true); // } // // protected BehaviourBase(EntitySheep entity, Supplier<Boolean> configuration) // { // this.entity = entity; // this.configuration = configuration; // } // // public boolean isBehaviourEnabled() { // return configuration.get(); // } // // public void onSheepMovedBlock(BlockPos previousLocation, BlockPos newLocation) {} // // public void onBehaviourStarted(BlockPos currentPos) {} // // public void onBehaviourStopped(BlockPos previousPos) {} // // public void updateTask() {} // // public boolean isEquivalentTo(T other) { // return entity.getUniqueID().equals(other.getEntity().getUniqueID()); // } // // public EntitySheep getEntity() // { // return entity; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/vanilla/behaviour/NoteBlockBehaviour.java import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.behaviour.BehaviourBase; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import net.minecraft.block.BlockNote; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.world.NoteBlockEvent; import java.util.function.Supplier; package com.github.atomicblom.shearmadness.variations.vanilla.behaviour; public class NoteBlockBehaviour extends BehaviourBase<NoteBlockBehaviour> { private final World world;
private final IChiseledSheepCapability capability;
AtomicBlom/ShearMadness
src/integration/java/com/github/atomicblom/shearmadness/variations/vanilla/behaviour/NoteBlockBehaviour.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/behaviour/BehaviourBase.java // @SuppressWarnings({"NoopMethodInAbstractClass", "ClassHasNoToStringMethod", "WeakerAccess"}) // public abstract class BehaviourBase<T extends BehaviourBase> { // private final EntitySheep entity; // private final Supplier<Boolean> configuration; // // protected BehaviourBase(EntitySheep sheep) { // this(sheep, () -> true); // } // // protected BehaviourBase(EntitySheep entity, Supplier<Boolean> configuration) // { // this.entity = entity; // this.configuration = configuration; // } // // public boolean isBehaviourEnabled() { // return configuration.get(); // } // // public void onSheepMovedBlock(BlockPos previousLocation, BlockPos newLocation) {} // // public void onBehaviourStarted(BlockPos currentPos) {} // // public void onBehaviourStopped(BlockPos previousPos) {} // // public void updateTask() {} // // public boolean isEquivalentTo(T other) { // return entity.getUniqueID().equals(other.getEntity().getUniqueID()); // } // // public EntitySheep getEntity() // { // return entity; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // }
import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.behaviour.BehaviourBase; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import net.minecraft.block.BlockNote; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.world.NoteBlockEvent; import java.util.function.Supplier;
package com.github.atomicblom.shearmadness.variations.vanilla.behaviour; public class NoteBlockBehaviour extends BehaviourBase<NoteBlockBehaviour> { private final World world; private final IChiseledSheepCapability capability; private boolean isTriggered = false; private BlockPos currentLocation = null; public NoteBlockBehaviour(EntitySheep entity, Supplier<Boolean> configuration) { super(entity, configuration); world = entity.getEntityWorld();
// Path: src/api/java/com/github/atomicblom/shearmadness/api/Capability.java // public final class Capability { // @CapabilityInject(IChiseledSheepCapability.class) // public static final net.minecraftforge.common.capabilities.Capability<IChiseledSheepCapability> CHISELED_SHEEP; // // static { // CHISELED_SHEEP = null; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/behaviour/BehaviourBase.java // @SuppressWarnings({"NoopMethodInAbstractClass", "ClassHasNoToStringMethod", "WeakerAccess"}) // public abstract class BehaviourBase<T extends BehaviourBase> { // private final EntitySheep entity; // private final Supplier<Boolean> configuration; // // protected BehaviourBase(EntitySheep sheep) { // this(sheep, () -> true); // } // // protected BehaviourBase(EntitySheep entity, Supplier<Boolean> configuration) // { // this.entity = entity; // this.configuration = configuration; // } // // public boolean isBehaviourEnabled() { // return configuration.get(); // } // // public void onSheepMovedBlock(BlockPos previousLocation, BlockPos newLocation) {} // // public void onBehaviourStarted(BlockPos currentPos) {} // // public void onBehaviourStopped(BlockPos previousPos) {} // // public void updateTask() {} // // public boolean isEquivalentTo(T other) { // return entity.getUniqueID().equals(other.getEntity().getUniqueID()); // } // // public EntitySheep getEntity() // { // return entity; // } // } // // Path: src/api/java/com/github/atomicblom/shearmadness/api/capability/IChiseledSheepCapability.java // public interface IChiseledSheepCapability // { // boolean isChiseled(); // // void unChisel(); // // void chisel(ItemStack itemStack); // // ItemStack getChiselItemStack(); // // int getItemIdentifier(); // // NBTTagCompound getExtraData(); // } // Path: src/integration/java/com/github/atomicblom/shearmadness/variations/vanilla/behaviour/NoteBlockBehaviour.java import com.github.atomicblom.shearmadness.api.Capability; import com.github.atomicblom.shearmadness.api.behaviour.BehaviourBase; import com.github.atomicblom.shearmadness.api.capability.IChiseledSheepCapability; import net.minecraft.block.BlockNote; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.world.NoteBlockEvent; import java.util.function.Supplier; package com.github.atomicblom.shearmadness.variations.vanilla.behaviour; public class NoteBlockBehaviour extends BehaviourBase<NoteBlockBehaviour> { private final World world; private final IChiseledSheepCapability capability; private boolean isTriggered = false; private BlockPos currentLocation = null; public NoteBlockBehaviour(EntitySheep entity, Supplier<Boolean> configuration) { super(entity, configuration); world = entity.getEntityWorld();
capability = entity.getCapability(Capability.CHISELED_SHEEP, null);
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java
// Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // }
import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.util.ResourceLocation;
package com.github.atomicblom.shearmadness.utility; public final class Reference { public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + "* CannotShear - You cannot shear the sheep while chiseled.\n"; public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; private Reference() {} public static final class Blocks { public static final String NORMAL_VARIANT = "normal";
// Path: src/integration/java/com/github/atomicblom/shearmadness/variations/CommonReference.java // public final class CommonReference { // public static final String MOD_ID = "shearmadness"; // public static final String MOD_NAME = "Shear Madness"; // public static final String VERSION = "@MOD_VERSION@"; // // private CommonReference() {} // } // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java import com.github.atomicblom.shearmadness.variations.CommonReference; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.util.ResourceLocation; package com.github.atomicblom.shearmadness.utility; public final class Reference { public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + "* CannotShear - You cannot shear the sheep while chiseled.\n"; public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; private Reference() {} public static final class Blocks { public static final String NORMAL_VARIANT = "normal";
public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone");
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/api/ShearMadnessBehaviour.java
// Path: src/api/java/com/github/atomicblom/shearmadness/api/behaviour/BehaviourBase.java // @SuppressWarnings({"NoopMethodInAbstractClass", "ClassHasNoToStringMethod", "WeakerAccess"}) // public abstract class BehaviourBase<T extends BehaviourBase> { // private final EntitySheep entity; // private final Supplier<Boolean> configuration; // // protected BehaviourBase(EntitySheep sheep) { // this(sheep, () -> true); // } // // protected BehaviourBase(EntitySheep entity, Supplier<Boolean> configuration) // { // this.entity = entity; // this.configuration = configuration; // } // // public boolean isBehaviourEnabled() { // return configuration.get(); // } // // public void onSheepMovedBlock(BlockPos previousLocation, BlockPos newLocation) {} // // public void onBehaviourStarted(BlockPos currentPos) {} // // public void onBehaviourStopped(BlockPos previousPos) {} // // public void updateTask() {} // // public boolean isEquivalentTo(T other) { // return entity.getUniqueID().equals(other.getEntity().getUniqueID()); // } // // public EntitySheep getEntity() // { // return entity; // } // }
import com.github.atomicblom.shearmadness.api.behaviour.BehaviourBase; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.item.ItemStack; import java.util.function.Function;
package com.github.atomicblom.shearmadness.api; class ShearMadnessBehaviour { private final Function<ItemStack, Boolean> handlesVariant;
// Path: src/api/java/com/github/atomicblom/shearmadness/api/behaviour/BehaviourBase.java // @SuppressWarnings({"NoopMethodInAbstractClass", "ClassHasNoToStringMethod", "WeakerAccess"}) // public abstract class BehaviourBase<T extends BehaviourBase> { // private final EntitySheep entity; // private final Supplier<Boolean> configuration; // // protected BehaviourBase(EntitySheep sheep) { // this(sheep, () -> true); // } // // protected BehaviourBase(EntitySheep entity, Supplier<Boolean> configuration) // { // this.entity = entity; // this.configuration = configuration; // } // // public boolean isBehaviourEnabled() { // return configuration.get(); // } // // public void onSheepMovedBlock(BlockPos previousLocation, BlockPos newLocation) {} // // public void onBehaviourStarted(BlockPos currentPos) {} // // public void onBehaviourStopped(BlockPos previousPos) {} // // public void updateTask() {} // // public boolean isEquivalentTo(T other) { // return entity.getUniqueID().equals(other.getEntity().getUniqueID()); // } // // public EntitySheep getEntity() // { // return entity; // } // } // Path: src/main/java/com/github/atomicblom/shearmadness/api/ShearMadnessBehaviour.java import com.github.atomicblom.shearmadness.api.behaviour.BehaviourBase; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.item.ItemStack; import java.util.function.Function; package com.github.atomicblom.shearmadness.api; class ShearMadnessBehaviour { private final Function<ItemStack, Boolean> handlesVariant;
private final Function<EntitySheep, BehaviourBase> behaviourFactory;
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/configuration/Settings.java
// Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java // public final class Reference // { // public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; // public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; // public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + // "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + // "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + // "* CannotShear - You cannot shear the sheep while chiseled.\n"; // public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; // public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; // public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + // "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; // public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; // public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; // public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; // public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; // public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; // public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; // // private Reference() {} // // public static final class Blocks { // public static final String NORMAL_VARIANT = "normal"; // // public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone"); // public static final ResourceLocation InvisibleGlowstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleGlowstone"); // public static final ResourceLocation InvisibleBookshelf = new ResourceLocation(CommonReference.MOD_ID, "invisibleBookshelf"); // // private Blocks() {} // } // // }
import com.github.atomicblom.shearmadness.utility.Reference; import net.minecraftforge.common.config.Configuration;
package com.github.atomicblom.shearmadness.configuration; @SuppressWarnings({"InnerClassFieldHidesOuterClassField", "BooleanMethodNameMustStartWithQuestion"}) public enum Settings { INSTANCE; public static final String CATEGORY = Configuration.CATEGORY_GENERAL; private boolean debugModels = false; private boolean debugInvisibleBlocks = false; public static boolean debugModels() { return INSTANCE.debugModels; } public static boolean debugInvisibleBlocks() { return INSTANCE.debugInvisibleBlocks; } public static void syncConfig(Configuration config) {
// Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java // public final class Reference // { // public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; // public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; // public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + // "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + // "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + // "* CannotShear - You cannot shear the sheep while chiseled.\n"; // public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; // public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; // public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + // "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; // public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; // public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; // public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; // public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; // public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; // public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; // // private Reference() {} // // public static final class Blocks { // public static final String NORMAL_VARIANT = "normal"; // // public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone"); // public static final ResourceLocation InvisibleGlowstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleGlowstone"); // public static final ResourceLocation InvisibleBookshelf = new ResourceLocation(CommonReference.MOD_ID, "invisibleBookshelf"); // // private Blocks() {} // } // // } // Path: src/main/java/com/github/atomicblom/shearmadness/configuration/Settings.java import com.github.atomicblom.shearmadness.utility.Reference; import net.minecraftforge.common.config.Configuration; package com.github.atomicblom.shearmadness.configuration; @SuppressWarnings({"InnerClassFieldHidesOuterClassField", "BooleanMethodNameMustStartWithQuestion"}) public enum Settings { INSTANCE; public static final String CATEGORY = Configuration.CATEGORY_GENERAL; private boolean debugModels = false; private boolean debugInvisibleBlocks = false; public static boolean debugModels() { return INSTANCE.debugModels; } public static boolean debugInvisibleBlocks() { return INSTANCE.debugInvisibleBlocks; } public static void syncConfig(Configuration config) {
INSTANCE.debugModels = config.getBoolean("debugModels", CATEGORY, false, Reference.DEBUG_MODELS);
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/proxy/CommonBlockProxy.java
// Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleBookshelfBlock.java // public class InvisibleBookshelfBlock extends InvisibleBlock // { // // @Override // public float getEnchantPowerBonus(World world, BlockPos pos) { // return 1; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleGlowstoneBlock.java // public class InvisibleGlowstoneBlock extends InvisibleBlock // { // // @Override // public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) // { // return 15; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleRedstoneBlock.java // public class InvisibleRedstoneBlock extends InvisibleBlock // { // // @Override // @Deprecated // public boolean canProvidePower(IBlockState state) // { // return true; // } // // @Override // @Deprecated // public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) // { // return 15; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Localization.java // public final class Localization { // private Localization() {} // // /** // * creates an unlocalized name for a block. // * // * There is no specific reason I use block.getRegistryName as the unlocalized names are not // * at all related to localization. This is merely a convenience, but you could have a lookup // * or even use the name of your block class. // * // * In practice, is should be in this format though: // * tile.{ModID}:{uniqueLocalizationId} // * // * Minecraft will automatically append .name to it. // * // * @param block The block to create a localization name for // * @return the localization key. // */ // public static String getUnlocalizedNameFor(Block block) { // final ResourceLocation registryName = block.getRegistryName(); // if (registryName == null) { // throw new RuntimeException("Attempt to get the registry name of a block that doesn't have one yet."); // } // return registryName.toString(); // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java // public final class Reference // { // public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; // public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; // public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + // "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + // "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + // "* CannotShear - You cannot shear the sheep while chiseled.\n"; // public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; // public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; // public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + // "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; // public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; // public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; // public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; // public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; // public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; // public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; // // private Reference() {} // // public static final class Blocks { // public static final String NORMAL_VARIANT = "normal"; // // public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone"); // public static final ResourceLocation InvisibleGlowstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleGlowstone"); // public static final ResourceLocation InvisibleBookshelf = new ResourceLocation(CommonReference.MOD_ID, "invisibleBookshelf"); // // private Blocks() {} // } // // }
import com.github.atomicblom.shearmadness.block.InvisibleBookshelfBlock; import com.github.atomicblom.shearmadness.block.InvisibleGlowstoneBlock; import com.github.atomicblom.shearmadness.block.InvisibleRedstoneBlock; import com.github.atomicblom.shearmadness.utility.Localization; import com.github.atomicblom.shearmadness.utility.Reference; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.GameRegistry;
package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings({"MethodMayBeStatic", "unused"}) public class CommonBlockProxy { public void registerBlocks() {
// Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleBookshelfBlock.java // public class InvisibleBookshelfBlock extends InvisibleBlock // { // // @Override // public float getEnchantPowerBonus(World world, BlockPos pos) { // return 1; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleGlowstoneBlock.java // public class InvisibleGlowstoneBlock extends InvisibleBlock // { // // @Override // public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) // { // return 15; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleRedstoneBlock.java // public class InvisibleRedstoneBlock extends InvisibleBlock // { // // @Override // @Deprecated // public boolean canProvidePower(IBlockState state) // { // return true; // } // // @Override // @Deprecated // public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) // { // return 15; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Localization.java // public final class Localization { // private Localization() {} // // /** // * creates an unlocalized name for a block. // * // * There is no specific reason I use block.getRegistryName as the unlocalized names are not // * at all related to localization. This is merely a convenience, but you could have a lookup // * or even use the name of your block class. // * // * In practice, is should be in this format though: // * tile.{ModID}:{uniqueLocalizationId} // * // * Minecraft will automatically append .name to it. // * // * @param block The block to create a localization name for // * @return the localization key. // */ // public static String getUnlocalizedNameFor(Block block) { // final ResourceLocation registryName = block.getRegistryName(); // if (registryName == null) { // throw new RuntimeException("Attempt to get the registry name of a block that doesn't have one yet."); // } // return registryName.toString(); // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java // public final class Reference // { // public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; // public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; // public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + // "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + // "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + // "* CannotShear - You cannot shear the sheep while chiseled.\n"; // public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; // public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; // public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + // "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; // public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; // public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; // public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; // public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; // public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; // public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; // // private Reference() {} // // public static final class Blocks { // public static final String NORMAL_VARIANT = "normal"; // // public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone"); // public static final ResourceLocation InvisibleGlowstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleGlowstone"); // public static final ResourceLocation InvisibleBookshelf = new ResourceLocation(CommonReference.MOD_ID, "invisibleBookshelf"); // // private Blocks() {} // } // // } // Path: src/main/java/com/github/atomicblom/shearmadness/proxy/CommonBlockProxy.java import com.github.atomicblom.shearmadness.block.InvisibleBookshelfBlock; import com.github.atomicblom.shearmadness.block.InvisibleGlowstoneBlock; import com.github.atomicblom.shearmadness.block.InvisibleRedstoneBlock; import com.github.atomicblom.shearmadness.utility.Localization; import com.github.atomicblom.shearmadness.utility.Reference; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.GameRegistry; package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings({"MethodMayBeStatic", "unused"}) public class CommonBlockProxy { public void registerBlocks() {
registerBlockAndItem(new InvisibleRedstoneBlock(), Reference.Blocks.InvisibleRedstone);
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/proxy/CommonBlockProxy.java
// Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleBookshelfBlock.java // public class InvisibleBookshelfBlock extends InvisibleBlock // { // // @Override // public float getEnchantPowerBonus(World world, BlockPos pos) { // return 1; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleGlowstoneBlock.java // public class InvisibleGlowstoneBlock extends InvisibleBlock // { // // @Override // public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) // { // return 15; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleRedstoneBlock.java // public class InvisibleRedstoneBlock extends InvisibleBlock // { // // @Override // @Deprecated // public boolean canProvidePower(IBlockState state) // { // return true; // } // // @Override // @Deprecated // public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) // { // return 15; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Localization.java // public final class Localization { // private Localization() {} // // /** // * creates an unlocalized name for a block. // * // * There is no specific reason I use block.getRegistryName as the unlocalized names are not // * at all related to localization. This is merely a convenience, but you could have a lookup // * or even use the name of your block class. // * // * In practice, is should be in this format though: // * tile.{ModID}:{uniqueLocalizationId} // * // * Minecraft will automatically append .name to it. // * // * @param block The block to create a localization name for // * @return the localization key. // */ // public static String getUnlocalizedNameFor(Block block) { // final ResourceLocation registryName = block.getRegistryName(); // if (registryName == null) { // throw new RuntimeException("Attempt to get the registry name of a block that doesn't have one yet."); // } // return registryName.toString(); // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java // public final class Reference // { // public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; // public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; // public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + // "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + // "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + // "* CannotShear - You cannot shear the sheep while chiseled.\n"; // public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; // public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; // public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + // "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; // public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; // public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; // public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; // public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; // public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; // public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; // // private Reference() {} // // public static final class Blocks { // public static final String NORMAL_VARIANT = "normal"; // // public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone"); // public static final ResourceLocation InvisibleGlowstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleGlowstone"); // public static final ResourceLocation InvisibleBookshelf = new ResourceLocation(CommonReference.MOD_ID, "invisibleBookshelf"); // // private Blocks() {} // } // // }
import com.github.atomicblom.shearmadness.block.InvisibleBookshelfBlock; import com.github.atomicblom.shearmadness.block.InvisibleGlowstoneBlock; import com.github.atomicblom.shearmadness.block.InvisibleRedstoneBlock; import com.github.atomicblom.shearmadness.utility.Localization; import com.github.atomicblom.shearmadness.utility.Reference; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.GameRegistry;
package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings({"MethodMayBeStatic", "unused"}) public class CommonBlockProxy { public void registerBlocks() {
// Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleBookshelfBlock.java // public class InvisibleBookshelfBlock extends InvisibleBlock // { // // @Override // public float getEnchantPowerBonus(World world, BlockPos pos) { // return 1; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleGlowstoneBlock.java // public class InvisibleGlowstoneBlock extends InvisibleBlock // { // // @Override // public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) // { // return 15; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleRedstoneBlock.java // public class InvisibleRedstoneBlock extends InvisibleBlock // { // // @Override // @Deprecated // public boolean canProvidePower(IBlockState state) // { // return true; // } // // @Override // @Deprecated // public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) // { // return 15; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Localization.java // public final class Localization { // private Localization() {} // // /** // * creates an unlocalized name for a block. // * // * There is no specific reason I use block.getRegistryName as the unlocalized names are not // * at all related to localization. This is merely a convenience, but you could have a lookup // * or even use the name of your block class. // * // * In practice, is should be in this format though: // * tile.{ModID}:{uniqueLocalizationId} // * // * Minecraft will automatically append .name to it. // * // * @param block The block to create a localization name for // * @return the localization key. // */ // public static String getUnlocalizedNameFor(Block block) { // final ResourceLocation registryName = block.getRegistryName(); // if (registryName == null) { // throw new RuntimeException("Attempt to get the registry name of a block that doesn't have one yet."); // } // return registryName.toString(); // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java // public final class Reference // { // public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; // public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; // public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + // "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + // "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + // "* CannotShear - You cannot shear the sheep while chiseled.\n"; // public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; // public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; // public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + // "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; // public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; // public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; // public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; // public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; // public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; // public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; // // private Reference() {} // // public static final class Blocks { // public static final String NORMAL_VARIANT = "normal"; // // public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone"); // public static final ResourceLocation InvisibleGlowstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleGlowstone"); // public static final ResourceLocation InvisibleBookshelf = new ResourceLocation(CommonReference.MOD_ID, "invisibleBookshelf"); // // private Blocks() {} // } // // } // Path: src/main/java/com/github/atomicblom/shearmadness/proxy/CommonBlockProxy.java import com.github.atomicblom.shearmadness.block.InvisibleBookshelfBlock; import com.github.atomicblom.shearmadness.block.InvisibleGlowstoneBlock; import com.github.atomicblom.shearmadness.block.InvisibleRedstoneBlock; import com.github.atomicblom.shearmadness.utility.Localization; import com.github.atomicblom.shearmadness.utility.Reference; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.GameRegistry; package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings({"MethodMayBeStatic", "unused"}) public class CommonBlockProxy { public void registerBlocks() {
registerBlockAndItem(new InvisibleRedstoneBlock(), Reference.Blocks.InvisibleRedstone);
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/proxy/CommonBlockProxy.java
// Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleBookshelfBlock.java // public class InvisibleBookshelfBlock extends InvisibleBlock // { // // @Override // public float getEnchantPowerBonus(World world, BlockPos pos) { // return 1; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleGlowstoneBlock.java // public class InvisibleGlowstoneBlock extends InvisibleBlock // { // // @Override // public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) // { // return 15; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleRedstoneBlock.java // public class InvisibleRedstoneBlock extends InvisibleBlock // { // // @Override // @Deprecated // public boolean canProvidePower(IBlockState state) // { // return true; // } // // @Override // @Deprecated // public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) // { // return 15; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Localization.java // public final class Localization { // private Localization() {} // // /** // * creates an unlocalized name for a block. // * // * There is no specific reason I use block.getRegistryName as the unlocalized names are not // * at all related to localization. This is merely a convenience, but you could have a lookup // * or even use the name of your block class. // * // * In practice, is should be in this format though: // * tile.{ModID}:{uniqueLocalizationId} // * // * Minecraft will automatically append .name to it. // * // * @param block The block to create a localization name for // * @return the localization key. // */ // public static String getUnlocalizedNameFor(Block block) { // final ResourceLocation registryName = block.getRegistryName(); // if (registryName == null) { // throw new RuntimeException("Attempt to get the registry name of a block that doesn't have one yet."); // } // return registryName.toString(); // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java // public final class Reference // { // public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; // public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; // public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + // "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + // "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + // "* CannotShear - You cannot shear the sheep while chiseled.\n"; // public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; // public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; // public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + // "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; // public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; // public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; // public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; // public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; // public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; // public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; // // private Reference() {} // // public static final class Blocks { // public static final String NORMAL_VARIANT = "normal"; // // public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone"); // public static final ResourceLocation InvisibleGlowstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleGlowstone"); // public static final ResourceLocation InvisibleBookshelf = new ResourceLocation(CommonReference.MOD_ID, "invisibleBookshelf"); // // private Blocks() {} // } // // }
import com.github.atomicblom.shearmadness.block.InvisibleBookshelfBlock; import com.github.atomicblom.shearmadness.block.InvisibleGlowstoneBlock; import com.github.atomicblom.shearmadness.block.InvisibleRedstoneBlock; import com.github.atomicblom.shearmadness.utility.Localization; import com.github.atomicblom.shearmadness.utility.Reference; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.GameRegistry;
package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings({"MethodMayBeStatic", "unused"}) public class CommonBlockProxy { public void registerBlocks() { registerBlockAndItem(new InvisibleRedstoneBlock(), Reference.Blocks.InvisibleRedstone);
// Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleBookshelfBlock.java // public class InvisibleBookshelfBlock extends InvisibleBlock // { // // @Override // public float getEnchantPowerBonus(World world, BlockPos pos) { // return 1; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleGlowstoneBlock.java // public class InvisibleGlowstoneBlock extends InvisibleBlock // { // // @Override // public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) // { // return 15; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleRedstoneBlock.java // public class InvisibleRedstoneBlock extends InvisibleBlock // { // // @Override // @Deprecated // public boolean canProvidePower(IBlockState state) // { // return true; // } // // @Override // @Deprecated // public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) // { // return 15; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Localization.java // public final class Localization { // private Localization() {} // // /** // * creates an unlocalized name for a block. // * // * There is no specific reason I use block.getRegistryName as the unlocalized names are not // * at all related to localization. This is merely a convenience, but you could have a lookup // * or even use the name of your block class. // * // * In practice, is should be in this format though: // * tile.{ModID}:{uniqueLocalizationId} // * // * Minecraft will automatically append .name to it. // * // * @param block The block to create a localization name for // * @return the localization key. // */ // public static String getUnlocalizedNameFor(Block block) { // final ResourceLocation registryName = block.getRegistryName(); // if (registryName == null) { // throw new RuntimeException("Attempt to get the registry name of a block that doesn't have one yet."); // } // return registryName.toString(); // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java // public final class Reference // { // public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; // public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; // public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + // "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + // "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + // "* CannotShear - You cannot shear the sheep while chiseled.\n"; // public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; // public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; // public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + // "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; // public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; // public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; // public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; // public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; // public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; // public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; // // private Reference() {} // // public static final class Blocks { // public static final String NORMAL_VARIANT = "normal"; // // public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone"); // public static final ResourceLocation InvisibleGlowstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleGlowstone"); // public static final ResourceLocation InvisibleBookshelf = new ResourceLocation(CommonReference.MOD_ID, "invisibleBookshelf"); // // private Blocks() {} // } // // } // Path: src/main/java/com/github/atomicblom/shearmadness/proxy/CommonBlockProxy.java import com.github.atomicblom.shearmadness.block.InvisibleBookshelfBlock; import com.github.atomicblom.shearmadness.block.InvisibleGlowstoneBlock; import com.github.atomicblom.shearmadness.block.InvisibleRedstoneBlock; import com.github.atomicblom.shearmadness.utility.Localization; import com.github.atomicblom.shearmadness.utility.Reference; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.GameRegistry; package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings({"MethodMayBeStatic", "unused"}) public class CommonBlockProxy { public void registerBlocks() { registerBlockAndItem(new InvisibleRedstoneBlock(), Reference.Blocks.InvisibleRedstone);
registerBlockAndItem(new InvisibleGlowstoneBlock(), Reference.Blocks.InvisibleGlowstone);
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/proxy/CommonBlockProxy.java
// Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleBookshelfBlock.java // public class InvisibleBookshelfBlock extends InvisibleBlock // { // // @Override // public float getEnchantPowerBonus(World world, BlockPos pos) { // return 1; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleGlowstoneBlock.java // public class InvisibleGlowstoneBlock extends InvisibleBlock // { // // @Override // public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) // { // return 15; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleRedstoneBlock.java // public class InvisibleRedstoneBlock extends InvisibleBlock // { // // @Override // @Deprecated // public boolean canProvidePower(IBlockState state) // { // return true; // } // // @Override // @Deprecated // public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) // { // return 15; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Localization.java // public final class Localization { // private Localization() {} // // /** // * creates an unlocalized name for a block. // * // * There is no specific reason I use block.getRegistryName as the unlocalized names are not // * at all related to localization. This is merely a convenience, but you could have a lookup // * or even use the name of your block class. // * // * In practice, is should be in this format though: // * tile.{ModID}:{uniqueLocalizationId} // * // * Minecraft will automatically append .name to it. // * // * @param block The block to create a localization name for // * @return the localization key. // */ // public static String getUnlocalizedNameFor(Block block) { // final ResourceLocation registryName = block.getRegistryName(); // if (registryName == null) { // throw new RuntimeException("Attempt to get the registry name of a block that doesn't have one yet."); // } // return registryName.toString(); // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java // public final class Reference // { // public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; // public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; // public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + // "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + // "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + // "* CannotShear - You cannot shear the sheep while chiseled.\n"; // public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; // public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; // public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + // "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; // public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; // public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; // public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; // public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; // public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; // public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; // // private Reference() {} // // public static final class Blocks { // public static final String NORMAL_VARIANT = "normal"; // // public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone"); // public static final ResourceLocation InvisibleGlowstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleGlowstone"); // public static final ResourceLocation InvisibleBookshelf = new ResourceLocation(CommonReference.MOD_ID, "invisibleBookshelf"); // // private Blocks() {} // } // // }
import com.github.atomicblom.shearmadness.block.InvisibleBookshelfBlock; import com.github.atomicblom.shearmadness.block.InvisibleGlowstoneBlock; import com.github.atomicblom.shearmadness.block.InvisibleRedstoneBlock; import com.github.atomicblom.shearmadness.utility.Localization; import com.github.atomicblom.shearmadness.utility.Reference; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.GameRegistry;
package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings({"MethodMayBeStatic", "unused"}) public class CommonBlockProxy { public void registerBlocks() { registerBlockAndItem(new InvisibleRedstoneBlock(), Reference.Blocks.InvisibleRedstone); registerBlockAndItem(new InvisibleGlowstoneBlock(), Reference.Blocks.InvisibleGlowstone);
// Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleBookshelfBlock.java // public class InvisibleBookshelfBlock extends InvisibleBlock // { // // @Override // public float getEnchantPowerBonus(World world, BlockPos pos) { // return 1; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleGlowstoneBlock.java // public class InvisibleGlowstoneBlock extends InvisibleBlock // { // // @Override // public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) // { // return 15; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleRedstoneBlock.java // public class InvisibleRedstoneBlock extends InvisibleBlock // { // // @Override // @Deprecated // public boolean canProvidePower(IBlockState state) // { // return true; // } // // @Override // @Deprecated // public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) // { // return 15; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Localization.java // public final class Localization { // private Localization() {} // // /** // * creates an unlocalized name for a block. // * // * There is no specific reason I use block.getRegistryName as the unlocalized names are not // * at all related to localization. This is merely a convenience, but you could have a lookup // * or even use the name of your block class. // * // * In practice, is should be in this format though: // * tile.{ModID}:{uniqueLocalizationId} // * // * Minecraft will automatically append .name to it. // * // * @param block The block to create a localization name for // * @return the localization key. // */ // public static String getUnlocalizedNameFor(Block block) { // final ResourceLocation registryName = block.getRegistryName(); // if (registryName == null) { // throw new RuntimeException("Attempt to get the registry name of a block that doesn't have one yet."); // } // return registryName.toString(); // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java // public final class Reference // { // public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; // public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; // public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + // "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + // "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + // "* CannotShear - You cannot shear the sheep while chiseled.\n"; // public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; // public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; // public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + // "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; // public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; // public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; // public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; // public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; // public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; // public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; // // private Reference() {} // // public static final class Blocks { // public static final String NORMAL_VARIANT = "normal"; // // public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone"); // public static final ResourceLocation InvisibleGlowstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleGlowstone"); // public static final ResourceLocation InvisibleBookshelf = new ResourceLocation(CommonReference.MOD_ID, "invisibleBookshelf"); // // private Blocks() {} // } // // } // Path: src/main/java/com/github/atomicblom/shearmadness/proxy/CommonBlockProxy.java import com.github.atomicblom.shearmadness.block.InvisibleBookshelfBlock; import com.github.atomicblom.shearmadness.block.InvisibleGlowstoneBlock; import com.github.atomicblom.shearmadness.block.InvisibleRedstoneBlock; import com.github.atomicblom.shearmadness.utility.Localization; import com.github.atomicblom.shearmadness.utility.Reference; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.GameRegistry; package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings({"MethodMayBeStatic", "unused"}) public class CommonBlockProxy { public void registerBlocks() { registerBlockAndItem(new InvisibleRedstoneBlock(), Reference.Blocks.InvisibleRedstone); registerBlockAndItem(new InvisibleGlowstoneBlock(), Reference.Blocks.InvisibleGlowstone);
registerBlockAndItem(new InvisibleBookshelfBlock(), Reference.Blocks.InvisibleBookshelf);
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/proxy/CommonBlockProxy.java
// Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleBookshelfBlock.java // public class InvisibleBookshelfBlock extends InvisibleBlock // { // // @Override // public float getEnchantPowerBonus(World world, BlockPos pos) { // return 1; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleGlowstoneBlock.java // public class InvisibleGlowstoneBlock extends InvisibleBlock // { // // @Override // public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) // { // return 15; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleRedstoneBlock.java // public class InvisibleRedstoneBlock extends InvisibleBlock // { // // @Override // @Deprecated // public boolean canProvidePower(IBlockState state) // { // return true; // } // // @Override // @Deprecated // public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) // { // return 15; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Localization.java // public final class Localization { // private Localization() {} // // /** // * creates an unlocalized name for a block. // * // * There is no specific reason I use block.getRegistryName as the unlocalized names are not // * at all related to localization. This is merely a convenience, but you could have a lookup // * or even use the name of your block class. // * // * In practice, is should be in this format though: // * tile.{ModID}:{uniqueLocalizationId} // * // * Minecraft will automatically append .name to it. // * // * @param block The block to create a localization name for // * @return the localization key. // */ // public static String getUnlocalizedNameFor(Block block) { // final ResourceLocation registryName = block.getRegistryName(); // if (registryName == null) { // throw new RuntimeException("Attempt to get the registry name of a block that doesn't have one yet."); // } // return registryName.toString(); // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java // public final class Reference // { // public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; // public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; // public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + // "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + // "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + // "* CannotShear - You cannot shear the sheep while chiseled.\n"; // public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; // public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; // public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + // "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; // public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; // public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; // public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; // public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; // public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; // public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; // // private Reference() {} // // public static final class Blocks { // public static final String NORMAL_VARIANT = "normal"; // // public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone"); // public static final ResourceLocation InvisibleGlowstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleGlowstone"); // public static final ResourceLocation InvisibleBookshelf = new ResourceLocation(CommonReference.MOD_ID, "invisibleBookshelf"); // // private Blocks() {} // } // // }
import com.github.atomicblom.shearmadness.block.InvisibleBookshelfBlock; import com.github.atomicblom.shearmadness.block.InvisibleGlowstoneBlock; import com.github.atomicblom.shearmadness.block.InvisibleRedstoneBlock; import com.github.atomicblom.shearmadness.utility.Localization; import com.github.atomicblom.shearmadness.utility.Reference; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.GameRegistry;
package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings({"MethodMayBeStatic", "unused"}) public class CommonBlockProxy { public void registerBlocks() { registerBlockAndItem(new InvisibleRedstoneBlock(), Reference.Blocks.InvisibleRedstone); registerBlockAndItem(new InvisibleGlowstoneBlock(), Reference.Blocks.InvisibleGlowstone); registerBlockAndItem(new InvisibleBookshelfBlock(), Reference.Blocks.InvisibleBookshelf); } private void registerBlockAndItem(Block block, ResourceLocation name) { GameRegistry.register(configureBlock(block, name)); GameRegistry.register(configureItemBlock(new ItemBlock(block))); } protected Block configureBlock(Block block, ResourceLocation name) { return block.setRegistryName(name)
// Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleBookshelfBlock.java // public class InvisibleBookshelfBlock extends InvisibleBlock // { // // @Override // public float getEnchantPowerBonus(World world, BlockPos pos) { // return 1; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleGlowstoneBlock.java // public class InvisibleGlowstoneBlock extends InvisibleBlock // { // // @Override // public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) // { // return 15; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleRedstoneBlock.java // public class InvisibleRedstoneBlock extends InvisibleBlock // { // // @Override // @Deprecated // public boolean canProvidePower(IBlockState state) // { // return true; // } // // @Override // @Deprecated // public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) // { // return 15; // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Localization.java // public final class Localization { // private Localization() {} // // /** // * creates an unlocalized name for a block. // * // * There is no specific reason I use block.getRegistryName as the unlocalized names are not // * at all related to localization. This is merely a convenience, but you could have a lookup // * or even use the name of your block class. // * // * In practice, is should be in this format though: // * tile.{ModID}:{uniqueLocalizationId} // * // * Minecraft will automatically append .name to it. // * // * @param block The block to create a localization name for // * @return the localization key. // */ // public static String getUnlocalizedNameFor(Block block) { // final ResourceLocation registryName = block.getRegistryName(); // if (registryName == null) { // throw new RuntimeException("Attempt to get the registry name of a block that doesn't have one yet."); // } // return registryName.toString(); // } // } // // Path: src/main/java/com/github/atomicblom/shearmadness/utility/Reference.java // public final class Reference // { // public static final CreativeTabs CreativeTab = CreativeTabs.BUILDING_BLOCKS; // public static final String MOD_GUI_FACTORY = "com.github.atomicblom.shearmadness.configuration.client.ModGuiFactory"; // public static final String BEHAVIOUR_COMMENT = "Sets the behaviour when a sheep is sheared\n" + // "* RevertSheep - will change the sheep back to a normal sheep (default).\n" + // "* ChiselFarm - will allow the sheep to produce chiseled blocks (warning, this currently allows duping ores).\n" + // "* CannotShear - You cannot shear the sheep while chiseled.\n"; // public static final String ALLOW_REDSTONE_COMMENT = "Chiseled redstone sheep will trigger Redstone circuits."; // public static final String ALLOW_BOOKSHELF_COMMENT = "Chiseled bookshelf sheep will affect enchanting tables."; // public static final String ALLOW_GLOWSTONE_COMMENT = "Chiseled glowstone sheep will light up the area around them.\n" + // "WARNING: testing shows this creates a lot of chunk recalculation. I do not recommend this option."; // public static final String ALLOW_CACTUS_COMMENT = "Chiseled Cactus sheep will deal damage players and destroy items."; // public static final String ALLOW_TNT_COMMENT = "Chiseled TNT Sheep will be explode if exposed to active redstone."; // public static final String ALLOW_FIRE_DAMAGE_COMMENT = "Chiseled Magma sheep will deal fire damage when touched."; // public static final String DEBUG_MODELS = "Models will be regenerated every frame drawn."; // public static final String DEBUG_INVISIBLE_BLOCKS = "Invisible Blocks will be shown in-game."; // public static final String ALLOW_AUTO_CRAFTING = "Crafting Table sheep will use their recipe to consume and produce items."; // // private Reference() {} // // public static final class Blocks { // public static final String NORMAL_VARIANT = "normal"; // // public static final ResourceLocation InvisibleRedstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleRedstone"); // public static final ResourceLocation InvisibleGlowstone = new ResourceLocation(CommonReference.MOD_ID, "invisibleGlowstone"); // public static final ResourceLocation InvisibleBookshelf = new ResourceLocation(CommonReference.MOD_ID, "invisibleBookshelf"); // // private Blocks() {} // } // // } // Path: src/main/java/com/github/atomicblom/shearmadness/proxy/CommonBlockProxy.java import com.github.atomicblom.shearmadness.block.InvisibleBookshelfBlock; import com.github.atomicblom.shearmadness.block.InvisibleGlowstoneBlock; import com.github.atomicblom.shearmadness.block.InvisibleRedstoneBlock; import com.github.atomicblom.shearmadness.utility.Localization; import com.github.atomicblom.shearmadness.utility.Reference; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.GameRegistry; package com.github.atomicblom.shearmadness.proxy; @SuppressWarnings({"MethodMayBeStatic", "unused"}) public class CommonBlockProxy { public void registerBlocks() { registerBlockAndItem(new InvisibleRedstoneBlock(), Reference.Blocks.InvisibleRedstone); registerBlockAndItem(new InvisibleGlowstoneBlock(), Reference.Blocks.InvisibleGlowstone); registerBlockAndItem(new InvisibleBookshelfBlock(), Reference.Blocks.InvisibleBookshelf); } private void registerBlockAndItem(Block block, ResourceLocation name) { GameRegistry.register(configureBlock(block, name)); GameRegistry.register(configureItemBlock(new ItemBlock(block))); } protected Block configureBlock(Block block, ResourceLocation name) { return block.setRegistryName(name)
.setUnlocalizedName(Localization.getUnlocalizedNameFor(block));
AtomicBlom/ShearMadness
src/main/java/com/github/atomicblom/shearmadness/block/InvisibleBlock.java
// Path: src/main/java/com/github/atomicblom/shearmadness/configuration/Settings.java // @SuppressWarnings({"InnerClassFieldHidesOuterClassField", "BooleanMethodNameMustStartWithQuestion"}) // public enum Settings // { // INSTANCE; // // public static final String CATEGORY = Configuration.CATEGORY_GENERAL; // // private boolean debugModels = false; // private boolean debugInvisibleBlocks = false; // // public static boolean debugModels() // { // return INSTANCE.debugModels; // } // public static boolean debugInvisibleBlocks() // { // return INSTANCE.debugInvisibleBlocks; // } // // public static void syncConfig(Configuration config) // { // INSTANCE.debugModels = config.getBoolean("debugModels", CATEGORY, false, Reference.DEBUG_MODELS); // INSTANCE.debugInvisibleBlocks = config.getBoolean("debugInvisibleBlocks", CATEGORY, false, Reference.DEBUG_INVISIBLE_BLOCKS); // // Shearing.syncConfig(config); // Behaviours.syncConfig(config); // } // // public enum Shearing // { // INSTANCE; // // public static final String CATEGORY = Configuration.CATEGORY_GENERAL + ".shearing"; // // private ShearBehaviour shearBehaviour = ShearBehaviour.RevertSheep; // // public static ShearBehaviour getBehaviour() { return INSTANCE.shearBehaviour; } // // private static void syncConfig(Configuration config) { // // final String[] validNames = new String[ShearBehaviour.values().length]; // for (int i = 0; i < ShearBehaviour.values().length; i++) // { // validNames[i] = ShearBehaviour.values()[i].name(); // } // // final String behaviour = config.getString("behaviour", CATEGORY, "RevertSheep", Reference.BEHAVIOUR_COMMENT, validNames); // INSTANCE.shearBehaviour = ShearBehaviour.valueOf(behaviour); // } // } // // public enum Behaviours // { // INSTANCE; // // public static final String CATEGORY = Configuration.CATEGORY_GENERAL + ".behaviours"; // // private boolean allowGlowstone = false; // private boolean allowRedstone = true; // private boolean allowBookshelf = true; // private boolean allowCactus = true; // private boolean allowTNT = true; // private boolean allowFireDamage = true; // private boolean allowAutoCrafting = true; // // // public static boolean allowRedstone() { // return INSTANCE.allowRedstone; // } // public static boolean allowBookshelf() { // return INSTANCE.allowBookshelf; // } // public static boolean allowGlowstone() { // return INSTANCE.allowGlowstone; // } // public static boolean allowCactus() { // return INSTANCE.allowCactus; // } // public static boolean allowTNT() { // return INSTANCE.allowTNT; // } // public static boolean allowFireDamage() { // return INSTANCE.allowFireDamage; // } // public static boolean allowAutoCrafting() { return INSTANCE.allowAutoCrafting; } // // // private static void syncConfig(Configuration config) { // INSTANCE.allowRedstone = config.getBoolean("allowRedstone", CATEGORY, true, Reference.ALLOW_REDSTONE_COMMENT); // INSTANCE.allowBookshelf = config.getBoolean("allowBookshelf", CATEGORY, true, Reference.ALLOW_BOOKSHELF_COMMENT); // INSTANCE.allowGlowstone = config.getBoolean("allowGlowstone", CATEGORY, false, Reference.ALLOW_GLOWSTONE_COMMENT); // INSTANCE.allowCactus = config.getBoolean("allowCactus", CATEGORY, true, Reference.ALLOW_CACTUS_COMMENT); // INSTANCE.allowTNT = config.getBoolean("allowTNT", CATEGORY, true, Reference.ALLOW_TNT_COMMENT); // INSTANCE.allowFireDamage = config.getBoolean("allowFireDamage", CATEGORY, true, Reference.ALLOW_FIRE_DAMAGE_COMMENT); // INSTANCE.allowAutoCrafting = config.getBoolean("allowAutoCrafting", CATEGORY, true, Reference.ALLOW_AUTO_CRAFTING); // } // } // // }
import com.github.atomicblom.shearmadness.configuration.Settings; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import javax.annotation.Nullable; import java.util.List;
@Nullable @Override @Deprecated public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) { return Block.NULL_AABB; } @Override @Deprecated public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn) { } @Override public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos) { return true; } @Override public int getLightOpacity(IBlockState state, IBlockAccess world, BlockPos pos) { return 0; } @Override @Deprecated public EnumBlockRenderType getRenderType(IBlockState state) {
// Path: src/main/java/com/github/atomicblom/shearmadness/configuration/Settings.java // @SuppressWarnings({"InnerClassFieldHidesOuterClassField", "BooleanMethodNameMustStartWithQuestion"}) // public enum Settings // { // INSTANCE; // // public static final String CATEGORY = Configuration.CATEGORY_GENERAL; // // private boolean debugModels = false; // private boolean debugInvisibleBlocks = false; // // public static boolean debugModels() // { // return INSTANCE.debugModels; // } // public static boolean debugInvisibleBlocks() // { // return INSTANCE.debugInvisibleBlocks; // } // // public static void syncConfig(Configuration config) // { // INSTANCE.debugModels = config.getBoolean("debugModels", CATEGORY, false, Reference.DEBUG_MODELS); // INSTANCE.debugInvisibleBlocks = config.getBoolean("debugInvisibleBlocks", CATEGORY, false, Reference.DEBUG_INVISIBLE_BLOCKS); // // Shearing.syncConfig(config); // Behaviours.syncConfig(config); // } // // public enum Shearing // { // INSTANCE; // // public static final String CATEGORY = Configuration.CATEGORY_GENERAL + ".shearing"; // // private ShearBehaviour shearBehaviour = ShearBehaviour.RevertSheep; // // public static ShearBehaviour getBehaviour() { return INSTANCE.shearBehaviour; } // // private static void syncConfig(Configuration config) { // // final String[] validNames = new String[ShearBehaviour.values().length]; // for (int i = 0; i < ShearBehaviour.values().length; i++) // { // validNames[i] = ShearBehaviour.values()[i].name(); // } // // final String behaviour = config.getString("behaviour", CATEGORY, "RevertSheep", Reference.BEHAVIOUR_COMMENT, validNames); // INSTANCE.shearBehaviour = ShearBehaviour.valueOf(behaviour); // } // } // // public enum Behaviours // { // INSTANCE; // // public static final String CATEGORY = Configuration.CATEGORY_GENERAL + ".behaviours"; // // private boolean allowGlowstone = false; // private boolean allowRedstone = true; // private boolean allowBookshelf = true; // private boolean allowCactus = true; // private boolean allowTNT = true; // private boolean allowFireDamage = true; // private boolean allowAutoCrafting = true; // // // public static boolean allowRedstone() { // return INSTANCE.allowRedstone; // } // public static boolean allowBookshelf() { // return INSTANCE.allowBookshelf; // } // public static boolean allowGlowstone() { // return INSTANCE.allowGlowstone; // } // public static boolean allowCactus() { // return INSTANCE.allowCactus; // } // public static boolean allowTNT() { // return INSTANCE.allowTNT; // } // public static boolean allowFireDamage() { // return INSTANCE.allowFireDamage; // } // public static boolean allowAutoCrafting() { return INSTANCE.allowAutoCrafting; } // // // private static void syncConfig(Configuration config) { // INSTANCE.allowRedstone = config.getBoolean("allowRedstone", CATEGORY, true, Reference.ALLOW_REDSTONE_COMMENT); // INSTANCE.allowBookshelf = config.getBoolean("allowBookshelf", CATEGORY, true, Reference.ALLOW_BOOKSHELF_COMMENT); // INSTANCE.allowGlowstone = config.getBoolean("allowGlowstone", CATEGORY, false, Reference.ALLOW_GLOWSTONE_COMMENT); // INSTANCE.allowCactus = config.getBoolean("allowCactus", CATEGORY, true, Reference.ALLOW_CACTUS_COMMENT); // INSTANCE.allowTNT = config.getBoolean("allowTNT", CATEGORY, true, Reference.ALLOW_TNT_COMMENT); // INSTANCE.allowFireDamage = config.getBoolean("allowFireDamage", CATEGORY, true, Reference.ALLOW_FIRE_DAMAGE_COMMENT); // INSTANCE.allowAutoCrafting = config.getBoolean("allowAutoCrafting", CATEGORY, true, Reference.ALLOW_AUTO_CRAFTING); // } // } // // } // Path: src/main/java/com/github/atomicblom/shearmadness/block/InvisibleBlock.java import com.github.atomicblom.shearmadness.configuration.Settings; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import javax.annotation.Nullable; import java.util.List; @Nullable @Override @Deprecated public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) { return Block.NULL_AABB; } @Override @Deprecated public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn) { } @Override public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos) { return true; } @Override public int getLightOpacity(IBlockState state, IBlockAccess world, BlockPos pos) { return 0; } @Override @Deprecated public EnumBlockRenderType getRenderType(IBlockState state) {
return Settings.debugInvisibleBlocks() ?