1. Java / Говнокод #24679

    −2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    99. 99
    public void pullToDirection(ForgeDirection dir) {
    		if (!canPullToDirection(dir))
    			return;
    		if (parentChunk.world.world.get().getBlockId(pipePosition.x + dir.offsetX, pipePosition.y + dir.offsetY,
    				pipePosition.z + dir.offsetZ) == AquaPipes.pipe.blockID) {
    			TransferPipeItem item = items.iterator().next();
    			if (item.isEmpty()) {
    				items.remove(item);
    				if (items.isEmpty()) {
    					parentChunk.pendingPipeStatesToRemove.add(this);
    					parentChunk.updateDataForAllObservers(this);
    				}
    				return;
    			}
    			items.remove(item);
    			if (items.isEmpty()) {
    				parentChunk.pendingPipeStatesToRemove.add(this);
    				parentChunk.updateDataForAllObservers(this);
    			}
    			parentChunk.world.pushToPipe(pipePosition.x + dir.offsetX, pipePosition.y + dir.offsetY,
    					pipePosition.z + dir.offsetZ, item.getStack());
    			return;
    		} else {
    			TileEntity te = parentChunk.world.world.get().getBlockTileEntity(pipePosition.x + dir.offsetX,
    					pipePosition.y + dir.offsetY, pipePosition.z + dir.offsetZ);
    			if (te != null) {
    				if (te instanceof ISidedInventory) {
    					TransferPipeItem item = items.iterator().next();
    					if (item.isEmpty()) {
    						items.remove(item);
    						if (items.isEmpty()) {
    							parentChunk.pendingPipeStatesToRemove.add(this);
    							parentChunk.updateDataForAllObservers(this);
    						}
    						return;
    					}
    					ISidedInventory inv = (ISidedInventory) te;
    					int[] slots = inv.getAccessibleSlotsFromSide(ForgeDirection.OPPOSITES[dir.ordinal()]);
    					for (int slot : slots) {
    						if (inv.canInsertItem(slot, item.getStack(), ForgeDirection.OPPOSITES[dir.ordinal()])
    								&& inv.isStackValidForSlot(slot, item.getStack())
    								&& (inv.getStackInSlot(slot) == null
    										|| (inv.getStackInSlot(slot).itemID == item.getStack().itemID
    												&& inv.getStackInSlot(slot).getItemDamage() == inv
    														.getStackInSlot(slot)
    														.getItemDamage()
    												&& inv.getStackInSlot(slot).stackSize < inv.getInventoryStackLimit()
    												&& inv.getStackInSlot(slot).stackSize < inv
    														.getStackInSlot(slot)
    														.getMaxStackSize()
    												&& ItemStack.areItemStackTagsEqual(inv.getStackInSlot(slot),
    														item.getStack())))) {
    							item.getStack().stackSize--;
    							inv.getStackInSlot(slot).stackSize++;
    							inv.onInventoryChanged();
    							if (item.isEmpty()) {
    								items.remove(item);
    								if (items.isEmpty()) {
    									parentChunk.pendingPipeStatesToRemove.add(this);
    									parentChunk.updateDataForAllObservers(this);
    								}
    							}
    						}
    					}
    				} else if (te instanceof IInventory) {
    					TransferPipeItem item = items.iterator().next();
    					if (item.isEmpty()) {
    						items.remove(item);
    						if (items.isEmpty()) {
    							parentChunk.pendingPipeStatesToRemove.add(this);
    							parentChunk.updateDataForAllObservers(this);
    						}
    						return;
    					}
    					IInventory inv = (IInventory) te;
    					for(int slot = 0; slot < inv.getSizeInventory(); slot++) {
    						if (inv.isStackValidForSlot(slot, item.getStack())
    								&& (inv.getStackInSlot(slot) == null
    										|| (inv.getStackInSlot(slot).itemID == item.getStack().itemID
    												&& inv.getStackInSlot(slot).getItemDamage() == inv
    														.getStackInSlot(slot)
    														.getItemDamage()
    												&& inv.getStackInSlot(slot).stackSize < inv.getInventoryStackLimit()
    												&& inv.getStackInSlot(slot).stackSize < inv
    														.getStackInSlot(slot)
    														.getMaxStackSize()
    												&& ItemStack.areItemStackTagsEqual(inv.getStackInSlot(slot),
    														item.getStack())))) {
    							item.getStack().stackSize--;
    							inv.getStackInSlot(slot).stackSize++;
    							inv.onInventoryChanged();
    							if (item.isEmpty()) {
    								items.remove(item);
    								if (items.isEmpty()) {
    									parentChunk.pendingPipeStatesToRemove.add(this);
    									parentChunk.updateDataForAllObservers(this);
    								}
    							}
    						}

    на закрывающие скобки не хватило места. код из моего еще не дописанного мода на майнкрафт.

    UsernameAK, 28 Августа 2018

    Комментарии (0)
  2. Java / Говнокод #24639

    −1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    public Pattern waitNotEmptyRegex(){
            String read;
            Pattern pattern;
    
            while (true) {
                try {
                    try {
                        read = in.readLine();
                        if (!read.trim().isEmpty()) {
                            pattern = Pattern.compile(read);
                        } else {
                            context.getOut().write(context.localizKey("console.messages.emptyString") + "\n");
                        }
                    } catch (PatternSyntaxException e) {
                        context.getOut().write(context.localizKey("console.messages.invalidPattern") + "\n");
                    }
                }catch (IOException e){
                    throw new IllegalStateException(e);
                }
            }
        }

    Боооольше вложенных блоков

    the-alator, 20 Августа 2018

    Комментарии (10)
  3. Java / Говнокод #24635

    −3

    1. 1
    System.out.println("The result of " + calc.getFirstNo() + " " + calc.getCharacter() + " " + calc.getSecondNo() + " is " + calc.calculate(calc.getFirstNo(), calc.getCharacter(), calc.getSecondNo()));

    shite, 19 Августа 2018

    Комментарии (13)
  4. Java / Говнокод #24461

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    public static final int CURENT_MILLENIUM = 2000; //must be changed in year 3000
    
    public int year;
    
    public void setYear(String year) {
      if (Integer.valueOf(year) < 100) {
        year = String.valueOf(CURENT_MILLENIUM + Integer.valueOf(year)).toString();
      }
      this.year = Integer.valueOf(year);
    }

    Ray_Mints, 09 Июля 2018

    Комментарии (4)
  5. Java / Говнокод #24356

    −1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    // aload x; iload x+1; ...
    // for normal (Object caller, param1, param2, ...) hook method startIndex must be 1
    private static InsnList getParamsLoadSequence(String typeDesc, int varStartIndex)
    {
        // get parameters descriptor
        typeDesc = typeDesc.substring(typeDesc.indexOf('(') + 1, typeDesc.lastIndexOf(')'));
        InsnList resSequence = new InsnList();
    
        int i = 0;
        while (i < typeDesc.length()) {
            resSequence.add(new VarInsnNode(parseLoadOpcode(typeDesc, i), varStartIndex++));
            i = getNextTypeIdx(typeDesc, i);
        }
    
        return resSequence;
    }

    ...но выбить сишку из человека нельзя.

    gost, 04 Июня 2018

    Комментарии (14)
  6. Java / Говнокод #24353

    −2

    1. 1
    https://pastebin.com/m3KsHvKF

    Говнооо! Говноооо! Мноооого говнаааа. Настолько много, что в 100 строк поместится только 2/16 говна. Это код калькулятора, который я писал когда только начинал изучать java - первый язык программирования. Особенно жестко на 30, 115, 150, 220, 700, 740, строках. Ну, короче, вы поняли - везде.

    the-alator, 03 Июня 2018

    Комментарии (8)
  7. Java / Говнокод #24342

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    package figury;
    import java.util.Scanner;
    public class figuremn {
    
    public static void main (String[] args){
    String [] monthyear = new String[12];
    monthyear [1] = "Январь";
    monthyear [2] = "Февраль";
    monthyear [3] = "Март";
    monthyear [4] = "Апрель";
    monthyear [5] = "май";
    monthyear [6] = "июнь";
    monthyear [7] = "июль";
    monthyear [8] = "август";
    monthyear [9] = "сентябрь";
    monthyear [10] = "октябрь";
    monthyear [11] = "ноябрь";
    monthyear [12] = "декабрь";
    System.out.println("Введите номер месяца");
    Scanner scan = new Scanner(System.in);
    String x = scan.nextLine;
    monthyear[]=x;
    {System.out.println(x);
    }
      }
    }

    Ray_Mints, 31 Мая 2018

    Комментарии (38)
  8. Java / Говнокод #24277

    −2

    1. 1
    2. 2
    3. 3
    // this method is used for storing name instead of password
        @Override
        public String getPassword() { return name; }

    gbuyankin, 17 Мая 2018

    Комментарии (113)
  9. Java / Говнокод #24274

    −1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    if (context instanceof Activity) {
                activity = (MainActivityMVI) context;
                try {
                    listener = (OnOfferItemClickListenerS) activity;
                } catch (ClassCastException e) {
                    throw new ClassCastException(activity.toString() + "must implement OnOfferItemClickListenerS");
                }
                try {
                    listener2 = (OnLoadDataSearchMainFragmentListener) activity;
                } catch (ClassCastException e) {
                    throw new ClassCastException(activity.toString() + "must implement OnLoadDataSearchMainFragmentListener");
                }
                App.getComponent(activity).inject(this);
            }

    makesense, 16 Мая 2018

    Комментарии (53)
  10. Java / Говнокод #24249

    +3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    if (x_sum_first_row == 3 || x_sum_second_row == 3 || x_sum_third_row == 3 ||
                x_sum_first_column == 3 || x_sum_second_column == 3 || x_sum_third_column == 3 ||
                x_sumDiagonalLR == 3 || x_sumDiagonalRL == 3 ||
                o_sum_first_row == 3 || o_sum_second_row == 3 || o_sum_third_row == 3 ||
                o_sum_first_column == 3 || o_sum_second_column == 3 || o_sum_third_column == 3 ||
                o_sumDiagonalLR == 3 || o_sumDiagonalRL == 3)
                someoneWon = true;
    
            return someoneWon;

    https://codereview.stackexchange.com/questions/125248/java-tic-tac-toe-game-implemented-through-mvc

    roskomgovno, 11 Мая 2018

    Комментарии (5)